0% found this document useful (0 votes)
7 views2 pages

DBMS Lab Exercise 1

just an exercise for btech dbms students

Uploaded by

livetosing41
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)
7 views2 pages

DBMS Lab Exercise 1

just an exercise for btech dbms students

Uploaded by

livetosing41
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/ 2

DBMS LAB EXERCISE 1

Q1> Write general syntax and example of following

->CREATE TABLE

Syntax: CREATE TABLE table_name eg: CREATE TABLE student

( col1 datatype, ( roll_no number(3),

Col2 datatype, name varchar(10),

………………….. dob varchar(10) );

…………..);

->INSERT COMMAND

Syntax: INSERT INTO table_name VALUES(val1,val2,val3,..);

Eg : INSERT INTO student VALUES(23,’ram’,’23-10-24’);

->UPDATE COMMAND

Syntax: UPDATE tablename SET col1=val1,col2=val2,….

Where <condition>;

Eg: UPDATE student SET roll_no=27 where name=’ram’;

->DELETE COMMAND

Syntax: DELETE TABLE table_name;

Eg : DELETE TABLE student;

->SELECT COMMAND

Syntax: SELECT col1,col2,col3,…… FROM table_name;

Eg : SELECT name, roll_no FROM student;

Q2> i) To add column

Syntax : ALTER TABLE tablename ADD(col_name datatype(size));

ii) To remove column

Syntax:ALTER TABLE tablename DROP COLUMN column_name;


Q4> i)syntax to add constraint after creating table

ALTER TABLE tablename ADD CONSTRAINT constraint_name;

ii) syntax to drop constraint after table creation

ALTER TABLE tablename DROP CONSTRAINT constraint_name;

Q5>

i) create table employee

(empID varchar(5),

empName varchar(30),

empCity varchar(15),

empAge number(2),

empSalary number(10,2),

empDesg varchar(15),

empDeptID varchar(5));

ii) insert into employee values('E1', 'Ram', 'Jaipur', 47 ,15000, 'Manager', 'D1');

iii) insert into employee (empID , empCity , empSalary) values(‘E2’ , ‘Agra’, 20000);

iv) select * from from employee where empCity=’Jaipur’ ;

v) select empDesg, empID from employee where empDeptID==’D1’;

vi)

You might also like