Creating database & tables using create statement.

1.create command: – Create command is use to create database and tables.

Syntax- create database databasename;

This image has an empty alt attribute; its file name is image.png

2.show command: – show command will show all the databases within the MySQL database.

This image has an empty alt attribute; its file name is image-1.png

3.use command: – use command is use to change your database where you would like to work.

Syntax: use databsename;

This image has an empty alt attribute; its file name is image-13.png

4.create table student(name varchar(20),roll_no int,addr varchar(30));

This image has an empty alt attribute; its file name is image-3.png

5.desc command: – desc command is use to describe the table structure.

Syntax: desc tablename;

This image has an empty alt attribute; its file name is image-4.png

Inserting data into table using insert command.

  1. insert command: – insert command is use to insert the data into table.

Syntax: insert into tablename values(value1,value2,value3);

or

insert into tablename(feild1, feild2,feild3)values(value1,value2,value3);

This image has an empty alt attribute; its file name is image-5.png

select command: – select command is use to retrieve the records from table. Syntax: select * from tablename;

This image has an empty alt attribute; its file name is image-6.png

Retrieve data using select statement & where clause.

  1. Retrieve name & address from the given relation. Syntax: select column1,column2 from table_name.
This image has an empty alt attribute; its file name is image-7.png

where clause: where clause return the record that matches the condition. Syntax: select * from table_name where  condition;

This image has an empty alt attribute; its file name is image-8.png

Retrieve roll no, name & address of those student with their address Shimla. Syntax: select column1,column 2,column3 from table_name where column3=condition;

This image has an empty alt attribute; its file name is image-9.png

Deleting data using delete statement. Delete command: delete command is use to delete the records from the relation.

Syntax: delete from table_name where condition.

Delete the record of the student where roll no is 5.

This image has an empty alt attribute; its file name is image-10.png

Delete records of those student with their class mca.

This image has an empty alt attribute; its file name is image-11.png

Delete all the records from the given relation.

This image has an empty alt attribute; its file name is image-12.png

Updating records using update command.

Update command: update command is use to update the records value in the table. 

Syntax: update table_name set column_name=value ,column_name=value where condition;    

Modify customers name f who supply part p4.

This image has an empty alt attribute; its file name is image-14.png

Modify part as p5 quantity as 500 of customers with customer id 102 and 103.

This image has an empty alt attribute; its file name is image-15.png

Modify customer id 105 who supply part p2.

This image has an empty alt attribute; its file name is image-16.png

Modify quantity as 200 with customer id 100,102,101.

This image has an empty alt attribute; its file name is image-17.png

Happy Coding 🙂