0% found this document useful (0 votes)
31 views

Week 2

The document discusses basic SQL commands used to create and manage a database and tables. It provides the syntax and examples for creating a database and table, inserting data, updating data, selecting data, deleting data, and dropping a table. Commands covered include CREATE DATABASE, CREATE TABLE, INSERT, UPDATE, SELECT, DELETE, and DROP TABLE.

Uploaded by

Jaya Vakapalli
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views

Week 2

The document discusses basic SQL commands used to create and manage a database and tables. It provides the syntax and examples for creating a database and table, inserting data, updating data, selecting data, deleting data, and dropping a table. Commands covered include CREATE DATABASE, CREATE TABLE, INSERT, UPDATE, SELECT, DELETE, and DROP TABLE.

Uploaded by

Jaya Vakapalli
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 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