The document contains details of 4 practical sessions related to SQL queries and functions. Practical 1 involves creating E-R diagrams for bus and library management systems. Practical 2 focuses on creating tables, adding/updating columns, inserting data, deleting rows. Practical 3 covers transactions using commit, rollback and adding constraints. Practical 4 describes aggregate functions like count, max, min, sum, average and group by/order by clauses. Practical 5 lists various MySQL string functions.
The document contains details of 4 practical sessions related to SQL queries and functions. Practical 1 involves creating E-R diagrams for bus and library management systems. Practical 2 focuses on creating tables, adding/updating columns, inserting data, deleting rows. Practical 3 covers transactions using commit, rollback and adding constraints. Practical 4 describes aggregate functions like count, max, min, sum, average and group by/order by clauses. Practical 5 lists various MySQL string functions.
The document contains details of 4 practical sessions related to SQL queries and functions. Practical 1 involves creating E-R diagrams for bus and library management systems. Practical 2 focuses on creating tables, adding/updating columns, inserting data, deleting rows. Practical 3 covers transactions using commit, rollback and adding constraints. Practical 4 describes aggregate functions like count, max, min, sum, average and group by/order by clauses. Practical 5 lists various MySQL string functions.
A. Aim:- CONCEPT DESIGN WITH E-R MODEL USING BUS RESERVATION SYSTEM B. Aim:- CONCEPT DESIGN WITH E-R MODEL USING LIBRARY MANAGEMENT SYSTEM
Practical- 2 Aim: CREATION OF TABLES
A. Create a table called Employee with the following structure.
i. Add a column commission with domain to the Employee table.
ii. Insert any five records into the table. iii. Update the column details of job iv. Rename the column of Employ table using alter command. v. Delete the employee whose Empno is 105.
B. Create a table called Customer table
i. Insert records into the table.
ii. Add salary column to the table. iii. Alter the table column domain. iv. Drop salary column of the customer table. v. Delete the rows of customer table whose cust_city is „hyd‟.
C. Create a table called sailor table
i. Add column age to the sailor table.
ii. Insert values into the sailor table. iii. Delete the row with rating >8. iv. Update the column details of sailor. v. Insert null values into the table. Practical – 3
i. Create a user and grant all permissions to the user.
ii. Insert the any three records in the employee table and use rollback. Check the result. iii. Add primary key constraint and not null constraint to the employee table. iv. Insert null values to the employee table and verify the result
B.
i. create a user and grant all permissions to the user.
ii. Insert values in the department table and use commit. iii. Add constraints like unique and not null to the department table. iv. Insert repeated values and null values into the table.
C.
i. create a user and grant all permissions to the user.
ii. Insert values into the table and use commit. iii. Delete any three records in the department table and use rollback. iv. Add constraint primary key and foreign key to the table.
Practical – 4
AIM :- Queries using aggregate functions(COUNT,AVG,MIN,MAX,SUM),Group by, Order by, Having.
(i) Create Employee table containing all Records.
(ii) Count number of employee names from employee table. (iii) Find the Maximum age from employee table. (iv) Find the Minimum age from employee table. (v) Display the Sum of age employee table. (vi) Display the Average of age from Employee table. (vii) Create a View for age in employee table. (viii) Display views. (ix) Find grouped salaries of employees.(group by clause) (x) Find salaries of employee in Ascending Order.(order by clause) (xi) Find salaries of employee in Descending Order (xii) Having salary<10000 Practical – 5
Aim: MySQL String Functions
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
CONCAT_WS Adds two or more expressions together with a
separator
FIELD Returns the index position of a value in a list of
values
FIND_IN_SET Returns the position of a string within a list of
strings
FORMAT Formats a number to a format like
"#,###,###.##", rounded to a specified number of decimal places
INSERT Inserts a string within a string at the specified
position and for a certain number of characters
INSTR Returns the position of the first occurrence of a
string in another string
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
LPAD Left-pads a string with another string, to a
certain length
LTRIM Removes leading spaces from a string
MID Extracts a substring from a string (starting at
any position)
POSITION Returns the position of the first occurrence of a
substring in a string
REPEAT Repeats a string as many times as specified
REPLACE Replaces all occurrences of a substring within a string, with a new substring
REVERSE Reverses a string and returns the result
RIGHT Extracts a number of characters from a string
(starting from right)
RPAD Right-pads a string with another string, to a
certain length
RTRIM Removes trailing spaces from a string
SPACE Returns a string of the specified number of
space characters
STRCMP Compares two strings
SUBSTR Extracts a substring from a string (starting at
any position)
SUBSTRING Extracts a substring from a string (starting at
any position)
SUBSTRING_INDEX Returns a substring of a string before a
specified number of delimiter occurs TRIM Removes leading and trailing spaces from a string