What is a database? How to create and use a database?
A free video tutorial from Pradnyankur Nikam
Freelance Web developer and Instructor, 9000+ Happy Students
2 courses
10,107 students
Lecture description
Lets understand about the database and create our first database. Also execute the SQL statement to select or use an existing database.
Learn more from the full course
SQL Tutorial: Learn SQL with MySQL Database
Learn SQL and Database Development to work effectively in DBMS like MySQL, SQL Server, Oracle, PostgreSQL, DB2 etc.
12:21:23 of on-demand video • Updated January 2025
Use SQL queries to interact with relational database management system (RDBMS).
Learn Database development & Structured Query Language fundamentals with MySQL.
Write complex SQL statements to perform data analysis and query reports. Master MySQL 8 database development.
You will learn SQL from basics to advanced topics. Like JOINS, Database Relationships, Database Normalization etc.
You will learn a skill useful for professional Database Development. Also learn Database Modeling & Database Management.
You will learn MySQL Workbench. It's a unified visual tool for database architects, developers, and Database Administrators.
English
The structured query language is all about databases. Therefore, we must first understand what a database is? The database is a structured set of information or data organized in such a way that a computer program can quickly access, manage and update it. In other words, Database is a collection of one or more tables and the tables contain "data rows" or "data records". Imagine database with an example of a refrigerator. The refrigerator is a database. The various compartments in the refrigerator are tables. And the vegetables, foods and beverages stored inside refrigerator's compartments are the data. To interact with any database first the user must have an appropriate privileges to access the database. Secondly the user must select the database before executing any SQL statement. The SQL statement to display an existing databases is, "SHOW DATABASES;" The SQL statement will return all the existing databases in our database management software. The SQL statement to create a new database is, "CREATE DATABASE school;" Where "school" is the new database name. To use a database the SQL statement is again very simple, "USE school;" Where "school" is an existing database name. And the SQL statement to delete a database is, "DROP DATABASE school;" Where "school" is an existing database name. Now lets learn with practical examples. Here, I have logged in, in my MySQL database server using my "root" username and password. Lets display all existing databases using the SQL statement, "SHOW DATABASES;" By default MySQL database server creates a couple of system databases, which stores all the users information likes username, password, privileges and so on and other database related settings. Now lets create a new database named "school". We will store students information in this database. Please Note: To create a new database, the logged in user must have "data definition language" privilege, that is the privilege to CREATE, SELECT, ALTER and DROP the database. We will learn about data definition language in next couple of lectures. The SQL statement to create a new database is, "CREATE DATABASE school;" (Here school is the name of our database). Hit Enter And you will get Query OK 1 rows affected message. That is the new database has been created. Now enter, "SHOW DATABASES;" SQL statement again. and you can see the new database "school" is created. To use the newly created database, we will have to select it. and the SQL statement to use the database is, "USE school;" You will get the database changed message. At the moment our database is empty, there are no tables or data rows inside the new database. We will create and populate the table with data in next lecture. In this lecture will use and display data from another database. Type, "USE mysql;" (to use MySQL's default database.) Now enter the SQL statement, "SELECT User FROM User;" The query will return all the usernames that exists in the "User" table of "mysql" database. Notice the username "admin" we created in previous section. Finally, lets remove the newly created database. And SQL statement to delete a database is "DROP DATABASE school;" Here school is the name of our database. We will get Query OK 0 rows affected message, that is our database is removed. Now again type "SHOW DATABASES;" SQL statement, to display the list of all the existing databases. and you can see, the "school" database is gone. In this lecture we learned how to create and use and drop the database. We will explore more database related SQL statements in later sections of this course.