Q1. Write a SQL command for following:
i) Student( roll_no,name, address, phone_number).
a) Add primary key constraint on roll_no and unique constraint on phone number.
b) Display the record of student whose name contains ‘a’ character.
ii) create new user ‘user1’ and set password ‘user123’.
a) Assign select permission on student table which is created by user ‘system’ to ‘user1’
and ‘user1’ should be able to assign same permission to other users
b) Revoke all the permission of ‘user1’ and also revoke the permissions which are issued
by ‘user1’ to other users.
iii) Consider the following database:
Employee(emp_id,name,dept_id,job,email,mobile_number,join_date,salary,mgr_id)
Department(dept_id,dept_name,block_no);
a) Query to display each department name ,number of employees in the department and
the average salary for all the employees in that department.
Extracted text: Q1. Write a SQL command for following: i) Student( roll_no,name, address, phone_number). a) Add primary key constraint on roll_no and unique constraint on phone number. b) Display the record of student whose name contains 'a' character. ii) create new user 'user1' and set password 'user123’. a) Assign select permission on student table which is created by user 'system' to 'userl' and 'userl' should be able to assign same permission to other users b) Revoke all the permission of 'userl’ and also revoke the permissions which are issued by 'userl' to other users. iii) Consider the following database: Employee(emp_id,name,dept_id.job,email,mobile_number,join_date,salary,mgr_id) Department(dept_id,dept_name,block_no); a) Query to display each department name ,number of employees in the department and the average salary for all the employees in that department.