You are on page 1of 7

‭Enrollment No.

: ET22BTCO038‬ ‭ atabase Management System‬


D
‭(‭B
‬ TCO13404‬‭)‬

‭Practical No : MID PRACTICAL‬

‭ .Consider the following employee database:‬


1
‭employee (employee-name, street, city)‬
‭works (employee-name, company-name, salary)‬
‭company (company-name, city)‬
‭manages (employee-name, manager_name)‬
‭Give an expression in SQL for each of the following queries:‬

‭ . Find the names of all employees who work for Union Bank.‬
1
‭->‬
‭SELECT EMPNAME‬
‭FROM WORKS‬
‭WHERE compname='UNION';‬

‭2023-24/BE_II_CO_DIV-I/Sem-4/DBMS‬ ‭Computer Engg. Deptt., SCET,‬ ‭1‬


‭Surat‬
‭Enrollment No. : ET22BTCO038‬ ‭ atabase Management System‬
D
‭(‭B
‬ TCO13404‬‭)‬

‭ . Give all employees of Axis Bank a 10-percent raise.‬


2
‭->‬
‭UPDATE WORKS‬
‭SET SALARY=SALARY+(SALARY*10/100);‬
‭WHERE COMPNAME='AXIS';‬
‭SELECT*FROM WORKS;‬

‭2023-24/BE_II_CO_DIV-I/Sem-4/DBMS‬ ‭Computer Engg. Deptt., SCET,‬ ‭2‬


‭Surat‬
‭Enrollment No. : ET22BTCO038‬ ‭ atabase Management System‬
D
‭(‭B
‬ TCO13404‬‭)‬

‭3. Find the names and cities of residence of all employees who work‬
‭for Axis Bank.‬
‭->‬
‭SELECT EMPLOYEE1.EMPNAME,EMPLOYEE1.CITY‬
‭FROM EMPLOYEE1‬
‭INNER JOIN WORKS‬
‭ON EMPLOYEE1.EMPNAME=WORKS.EMPNAME‬
‭WHERE COMPNAME='AXIS';‬

‭4. Find the names, street addresses, and cities of residence of all‬
‭employees who work for Punjab Bank and earn more than 10000.‬
‭->‬
‭SELECT EMPLOYEE1.EMPNAME,EMPLOYEE1.STREET,employee1.CITY‬
‭FROM EMPLOYEE1‬
‭INNER JOIN WORKS‬

‭2023-24/BE_II_CO_DIV-I/Sem-4/DBMS‬ ‭Computer Engg. Deptt., SCET,‬ ‭3‬


‭Surat‬
‭Enrollment No. : ET22BTCO038‬ ‭ atabase Management System‬
D
‭(‭B
‬ TCO13404‬‭)‬

‭ON EMPLOYEE1.EMPNAME=WORKS.EMPNAME‬
‭WHERE COMPNAME='PANJAB' AND SALARY>10000;‬

‭5. Find all employees who live in the same cities as the companies‬
‭for which they work.‬
‭->‬
‭SELECT EMPLOYEE1.EMPNAME‬
‭FROM EMPLOYEE1‬
‭INNER JOIN COMPANY1‬
‭ON EMPLOYEE1.CITY=COMPANY1.CITY‬
‭WHERE EMPLOYEE1.CITY=COMPANY1.CITY;‬

‭2023-24/BE_II_CO_DIV-I/Sem-4/DBMS‬ ‭Computer Engg. Deptt., SCET,‬ ‭4‬


‭Surat‬
‭Enrollment No. : ET22BTCO038‬ ‭ atabase Management System‬
D
‭(‭B
‬ TCO13404‬‭)‬

6‭ .Find the name of employees whose name who have ‘s’ at any‬
‭position in their names.‬
‭->‬
‭SELECT EMPNAME‬
‭FROM EMPLOYEE1‬
‭WHERE EMPNAME LIKE '%S%';‬

‭2023-24/BE_II_CO_DIV-I/Sem-4/DBMS‬ ‭Computer Engg. Deptt., SCET,‬ ‭5‬


‭Surat‬
‭Enrollment No. : ET22BTCO038‬ ‭ atabase Management System‬
D
‭(‭B
‬ TCO13404‬‭)‬

‭2023-24/BE_II_CO_DIV-I/Sem-4/DBMS‬ ‭Computer Engg. Deptt., SCET,‬ ‭6‬


‭Surat‬
‭Enrollment No. : ET22BTCO038‬ ‭ atabase Management System‬
D
‭(‭B
‬ TCO13404‬‭)‬

‭Input :‬

‭Output :‬

‭2023-24/BE_II_CO_DIV-I/Sem-4/DBMS‬ ‭Computer Engg. Deptt., SCET,‬ ‭7‬


‭Surat‬

You might also like