COMSATS University Islamabad
Database Systems
Lab Assignment no. 01
Registration number: FA23-BCS-043-3A
Name: Eman Zahra
Topic: Implementation of Different Commands in mySQL.
Command no. 01: Show Database
Purpose: In order to see databases in system, we use this command.
Syntax: show databases;
Command No.02: Create Database.
Purpose: Used to create new database system where we can make and store
tables.
Syntax: create database database_name;
Example: create database school;
Command No.03: Use database.
Purpose: To use the database we created. (School database in this case).
Syntax: use database_name;
Command No.04: Create table.
Purpose: In order to create a table in database and store the data inside, we
use this command.
Syntax: create table table_name();
Command No.05: See the table created.
Purpose: This command is used to see the table we created in the database
(school).
Syntax: show tables;
Command No.06: See the structure of table.
Purpose: Shows the structure of the table including column names,
datatypes etc.
Syntax: desc table_name (student in this case)
Command No.07: Insert Command.
Purpose: this command is used to store data.
Syntax: insert into_table values(value_1,value_2,...);
Command No.08: Insert Multiple rows.
Purpose: Inserts multiple values into the table in one command.
Syntax: insert into_table(Char_1,char_2,...)values(value_1,value_2,...);
Command No.09: See values stored in table.
Purpose: This command is used to see the values that have been stored in
table by the user.
Syntax: SELECT * From table_name;
Command No. 10: Select specific column in table.
Purpose: To see a specific column in table, we use this command.
Syntax: select column_name from table_name;
Command No.11: Select multiple columns.
Purpose: Retrieve data from multiple columns.
Syntax: select column_1,column_2 from table_name;
Command No. 12: Select with ‘where’ clause.
Purpose: This command is used to see column based on a condition.
Syntax: select * from table_name where condition_name;
Command No.13: Drop table.
Purpose: To delete the table, we use this command.
Syntax: drop table table_name;
Command No. 14: Delete database.
Purpose: We use this command to delete the whole database.
Syntax: drop database database_name;