You are on page 1of 2

Copyright (c) 2000, 2024, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its


affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> show databases


-> ^C
mysql> show databases; //display inbuilt as well as created database.
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| sakila |
| sys |
| world |
+--------------------+
6 rows in set (0.02 sec)

mysql> create database shital;


Query OK, 1 row affected (0.01 sec)

mysql> show databases;


+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| sakila |
| shital |
| sys |
| world |
+--------------------+
7 rows in set (0.00 sec)

mysql> use shital; // use the database


Database changed
mysql> show tables; //check is there any table existing in the database
Empty set (0.01 sec)

mysql> create table person(pid int,pname varchar(20),city varchar(20),country


varchar(20));
Query OK, 0 rows affected (0.02 sec)

mysql> show tables;


+------------------+
| Tables_in_shital |
+------------------+
| person |
+------------------+
1 row in set (0.00 sec)

mysql> desc person;


+---------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+---------+-------------+------+-----+---------+-------+
| pid | int | YES | | NULL | |
| pname | varchar(20) | YES | | NULL | |
| city | varchar(20) | YES | | NULL | |
| country | varchar(20) | YES | | NULL | |
+---------+-------------+------+-----+---------+-------+
4 rows in set (0.00 sec)

mysql> insert into person(pid,pname,city,country) values(101,"palak","pune","USA");


Query OK, 1 row affected (0.00 sec)

mysql> insert into person values(102,"vrushali","dhule","india");


Query OK, 1 row affected (0.00 sec)

mysql> select * from person;


+------+----------+-------+---------+
| pid | pname | city | country |
+------+----------+-------+---------+
| 101 | palak | pune | USA |
| 102 | vrushali | dhule | india |
+------+----------+-------+---------+
2 rows in set (0.00 sec)

mysql> insert into person values(103,"ram","Shirdi","india"),


(104,"siya","Shirdi","India");
Query OK, 2 rows affected (0.00 sec)
Records: 2 Duplicates: 0 Warnings: 0

mysql> select pname from person;


+----------+
| pname |
+----------+
| palak |
| vrushali |
| ram |
| siya |
+----------+
4 rows in set (0.00 sec)

You might also like