Loading
Creating First Database

Q1. What is a database in SQL ?
A database in SQL is a structured container that stores and organizes data in the form of tables.
It acts like a central place where related information is kept together for easy access and management.
Each database can contain multiple tables, and each table stores a specific type of data such as students, products, or orders.
Databases help maintain data consistency, security, and organization.
In SQL-based systems, all data operations such as inserting, updating, and retrieving data are performed inside a database.


Q2. Why do we need to create a database before creating tables ?
A database provides a logical boundary to organize data properly.
Before creating tables, SQL needs to know where those tables will be stored.
Creating a database first ensures that all related tables stay together in one place.
This improves data management, scalability, and security.
Without a database, tables would have no container, making data organization impossible.


Q3. Explain the CREATE DATABASE command.
The CREATE DATABASE command is used to create a new database in the SQL server.
It tells the database system to allocate space and prepare a container for storing tables.
Once a database is created, users can start adding tables, inserting data, and managing records inside it.
It is usually the very first command executed when starting a new SQL project.
This command ensures structured and organized data storage from the beginning.


Q4. What is the purpose of the SHOW DATABASES command ?
The SHOW DATABASES command displays a list of all databases available on the SQL server.
It helps users verify whether a database has been created successfully or not.
This command is useful when working with multiple databases and switching between them.
It also helps in database administration and debugging tasks.
In simple words, it gives visibility into what databases exist.


Q5. What does the USE command do in SQL ?
The USE command selects a specific database to work with.
After using this command, all SQL operations such as creating tables or inserting data apply to the selected database.
It prevents accidental operations on the wrong database.
This command is essential when multiple databases exist on the same server.
Think of it as entering a folder before creating or editing files.