Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 5

Week-2

Database:-a database is a collection of


relations\tables

Syntax:-create database database_name;

Example:-create database student;

And use this database for creating the tables


then, we use the command called “use
student;”.

Creating table:-a table consists of number of attributes and number of relations .

Syntax:-create table table_name (coloumn1 datatype(size),coloumn2 datatype(size),coloumn3


datatype(size));

Example:-create table student_details(rollno varchar(10),name varchar(20),class varchar(30));


Description of table:-it is used to show the description of a particular table.

Syntax:-desc table_name;

Example:- desc student_details;

Inserting data into the table:-this is used for insert the data in table

Syntax:-insert into tablename (coloumn1,coloumn2,coloumn3)values(value1,value2,value3);

Example:-insert into student_details values(‘2’,’sampath’,’it’),(‘3’,’naveen’,’it’),(‘4’,’mahesh’,’it’);

Update command is used to modify the data in a table

Syntax:-update tablename set coloumn_name=’value’ where name=’value’;

Example:-update student_details set rollno=’2’ where name=’naveen’;


select command is used to display the content in a table

syntax:-select *from tablename;

example:-select *from student_details;


Delete command is used to delete the content ina table

Syntax:-delete from tablename where coloumnname=’value’;

Example:-delete from student_details where phone=’123456789’;

Drop command is used to delete entire table and data

Syntax:-drop table table_name;

Example:-drop table student_details;

You might also like