Database II Practical 2021-2022
Database II Practical 2021-2022
PRACTICAL ONE
TOPIC: DDL and DML
AIM: To recall the DDL and DML used in Database designI to
create the tables (Dept and Emp)
Here are the SQL codes for the DDL for creating the tables:
2. Join the dept table to the emp table and show in department
number order
order by deptno;
PRACTICAL FOUR
TOPIC: SQL Join
Aim: To know how to create join in MYSQL to extract data from
more than one table at a time
TOPIC: FUNCTION
Function Description
ASCII Returns the ASCII value for the specific
character
CHAR_LENGTH Returns the length of a string (in
characters)
CHARACTER_LENGTH Returns the length of a string (in
characters)
CONCAT Adds two or more expressions together
INSERT Inserts a string within a string at the
specified position and for a certain
number of characters
LCASE Converts a string to lower-case
LEFT Extracts a number of characters from a
string (starting from left)
LENGTH Returns the length of a string (in bytes)
LOCATE Returns the position of the first
occurrence of a substring in a string
LOWER Converts a string to lower-case
RIGHT Extracts a number of characters from a
string (starting from right)
UCASE Converts a string to upper-case
UPPER Converts a string to upper-case
AVG Computes the average value (disregards any
NULLs)
PRACTICAL SIX
TOPIC: FUNCTION
FROM emp;
PRACTICAL SEVEN
TOPIC: FUNCTION
FROM emp
2. Find the highest and lowest paid employee and the difference
between them.
FROM emp;
FROM dept;
PRACTICAL EIGHT
empno NUMERIC(4),
type VARCHAR(1),
amount NUMERIC(8,2))
2. Insert the following data
23 7499 M 20000.00
42 7499 C 2000.00
65 7844 M 3564.20
column.
the loan.
UPDATE loans
SET balance = balance*1.1
WHERE type = ‘M’;