DBMS Lab File
DBMS Lab File
DBMS Lab File
Signature
1 Create table with following field. Student
(Roll no., name, age, contact no., course)
Experiment No. 01
Object:
Syntax:
CREATE TABLE table_name (
column1 datatype,
column2 datatype,
column3 datatype,
....
);
Example:
create table class
(
Roll no int not null,
name varchar(255),
age varchar(255),
contact no varchar(255)
course varchar(255),
);
Result:
Theory:
The CREATE TABLE statement is used to create a new table in a
database. The datatype parameter specifies the type of data the
column can hold (e.g. varchar, integer, date, etc.).
Experiment No. 02
Result:
Theory:
The INSERT INTO statement is used to insert new records in a
table.
Experiment No. 03
Object: Select all the student of B.C.A.
Syntax:
SELECT column1, column2, ...
FROM table_name;
Example:
SELECT * FROM table_name;
Conditional select:
Theory:
Syntax:
UPDATE table_name
SET column1 = value1, column2 = value2, ...
WHERE condition;
Example:
UPDATE Class
SET Course = 'BCA'
WHERE name = ‘komal;
Result:
Theory:
The UPDATE statement is used to modify the existing records in
a table.
Syntax:
SELECT * FROM table_name;
Example:
SELECT * FROM class;
Result:
Theory:
Syntax:
SELECT COUNT(column_name)
FROM table_name
WHERE condition;
Example:
SELECT COUNT(name)
FROM class
WHERE course = ‘BCA’
Or
SELECT COUNT(name)
FROM class
WHERE course = ‘BBA’
Result:
Number of record 1
COUNT(course)
3
Or
Number of record 1
COUNT(course)
2
Theory:
The following SQL statement finds the number of student who
studied in BCA or BBA.
Syntax:
SELECT COUNT(column_name)
FROM table_name
Example:
SELECT COUNT(name)
FROM class
Result:
Number of record 1
COUNT(name)
5
Theory:
The following SQL statement finds the number of student.