2 Practical . Write SQL query for given problem statement
In MySQL, you can view a list of all databases using the following SQL command:
> show databases;
mysql> show databases; +------------------+ |Databases | +------------------+ |information_schema| |bank_system | |college | |sahil138 | +------------------+ 7 rows in set (0.01 sec)
B) Creating a Databases:
In MySQL, you can create a new database using the
CREATE DATABASE
statement. Here's the basic syntax: create databases [IF NOT EXISTS] database_name;mysql> create databases sahil38; Query OK, 1 row affectedn(0.01 sec)
After creating the database, you can use it by selecting it with the
USE
statement:syntax : USE database_name;
mysql> use sahil38; Database changed
To view all tables from your database, you can use the following SQL query:
>show tables;
mysql> show tables; +------------------+ |Tables_in_sahil38 | +------------------+ |sahil_info | +------------------+ 1 row is set (0.00 sec)