SQ L Examples
SQ L Examples
USE employee;
SELECT * FROM emp_details;
(i)To display Employee no. , first name, surname, last
name of every record.
(iv) To display Employee no. , first name, surname, last name and
salary where salary is between 5000 and 10000.
(viii) To display Employee no. , first name, surname, last name and
date of birth of those who are born in the month of June in the
chronological order of date of birth.
(xiv) To display the next 5 entries starting with the 10th row.
(xviii) To display name of the dept and average salary for each
dept.
(xx) To display name of the dept and average age where average age
is more than 30.
(xxiv) To delete the records of all the employees whose age is more
than 55 years.
SELECT emp_no, fname, surname, dept, desig, sal, addr, ph_no, mobile,
email, app_DATE FROM emp_details INNER JOIN emp_personal USING
(emp_no);
(ii) Table name :FYBCOM _STUDENTS,LIBRARY
Write MySQL Statement to display Admission number , first
name, surname, Book name, accession no., date of issue,
authors name.
USE student;
SELECT adm_no, fname, surname, Bookname, acc_no, dtofissue,
author FROM fybcom_students INNER JOIN library
USING(adm_no);
Table name : Employee details(EMP_DETAILS)
Write MySQL sub query for the following
(i) Display Employee no., first name, surname, department,
designation and salary for those employees who have salary more
than minimum salary for all the records.
USE employee;
SELECT emp_no,fname,surname,dept,desig,sal FROM emp_details
WHERE (select min(sal) FROM emp_details)<sal;
(ii) Display Employee no., first name, surname, department,
designation and salary for those employees who have salary
equal to average salary for all the records.