DBMS Lab File
DBMS Lab File
PRACTICAL- 01
• CHAR(size)
A FIXED length string (can contain letters, numbers, and special characters). The size
parameter specifies the column length in characters - can be from 0 to 255. Default is 1
• VARCHAR(size)
A VARIABLE length string (can contain letters, numbers, and special characters). The size
parameter specifies the maximum column length in characters - can be from 0 to 65535
• INT(size)
A medium integer. Signed range is from -2147483648 to 2147483647. Unsigned range is
from 0 to 4294967295. The size parameter specifies the maximum display width (which is
255)
• DECIMAL(size, d)
An exact fixed-point number. The total number of digits is specified in size. The number of
digits after the decimal point is specified in the d parameter. The maximum number for size
is 65. The maximum number for d is 30. The default value for size is 10. The default value for
d is 0.
• DOUBLE(size, d)
A normal-size floating point number. The total number of digits is specified in size. The
number of digits after the decimal point is specified in the d parameter.
• FLOAT(size, d)
A floating point number. The total number of digits is specified in size. The number of digits
after the decimal point is specified in the d parameter. This syntax is deprecated in MySQL
8.0.17, and it will be removed in future MySQL versions.
• BOOLEAN
BOOL- Zero is considered as false, nonzero values are considered as true.
2
• DATE
A date. Format: YYYY-MM-DD. The supported range is from '1000-01-01' to '9999-12-31'
• DATETIME(fsp)
A date and time combination. Format: YYYY-MM-DD hh:mm:ss. The supported range is from
'1000-01-01 00:00:00' to '9999-12-31 23:59:59'. Adding DEFAULT and ON UPDATE in the
column definition to get automatic initialization and updating to the current date and time.
• TIMESTAMP(fsp)
A timestamp. TIMESTAMP values are stored as the number of seconds since the Unix epoch
('1970-01-01 00:00:00' UTC). Format: YYYY-MM-DD hh:mm:ss. The supported range is from
'1970-01-01 00:00:01' UTC to '2038-01-09 03:14:07' UTC. Automatic initialization and
updating to the current date and time can be specified using DEFAULT
CURRENT_TIMESTAMP and ON UPDATE CURRENT_TIMESTAMP in the column definition
QUERY:
OUTPUT:
3
PRACTICAL – 02
Entity Relationship Diagram:
4
PRACTICAL – 03
QUERY
Name VARCHAR(45) ,
Email VARCHAR(45)
);
OUTPUT
5
PRACTICAL- 04
QUERY
INSERT INTO schema1.table1 (`id`, `Name`, `Email`) VALUES ('01', 'Aryan', '[email protected]');
INSERT INTO schema1.table1 (`id`, `Name`, `Email`) VALUES ('02', 'Pooja', '[email protected]');
INSERT INTO schema1.table1 (`id`, `Name`, `Email`) VALUES ('03', 'Gargi', '[email protected]');
INSERT INTO schema1.table1 (`id`, `Name`, `Email`) VALUES ('04', 'Aashu', '[email protected]');
OUTPUT
6
PRACTICAL- 05
AGGREGRATE FUNCTIONS
• SUM
QUERY
OUTPUT
7
• AVERAGE
QUERY
OUTPUT
8
PRACTICAL-06
SQL QUERIES:
TABLES:
Reser:
Show:
Theatre:
9
Query 1:
Name all the theatres who have not made a reservation yet.
Query:
Output:
Query 2:
Name of all the theatres who have booked a show with show id =’12’
Query:
Output:
Query 3:
Name of all theatres who have booked a show by production house= “Dharma”.
Query:
Output:
10
Query 4:
Find the name of production house who has been booked by theatre id = ‘2’.
Query:
Output:
Query 5:
Find the name of all the theatres who have made reservation for the day 2022-02-03, 2022-01-
05 and 2022-03-09.
Query:
Output:
Query 6:
Find all the show name that have not been booked yet.
Query:
Output:
11
Query 7:
Find the name of theatre who has booked all the shows.
Query:
Output:
Query 8:
Query:
Output:
12
Query 9:
Query:
Output:
13
PRACTICAL-07
Group By/Order By
Query:
Output:
14
PRACTICAL- 08
View
Query:
Output:
15
EXPERIMENT- 09
Procedures
Query:
Output:
16
EXPERIMENT-10
String
Like-
Query:
Output:
Trim-
Query:
Output: