0% found this document useful (0 votes)
26 views7 pages

Kumaran Manangatti Dharman Lekha Assignment 6 - Introduction To SQL

The document provides instructions for an assignment involving SQL queries on 6 database tables: EMPLOYEE, DEPARTMENT, DEPT_LOCATIONS, WORKS_ON, PROJECT, and DEPENDENT. Students are asked to submit dumps of each table, the SQL for 10 problems, snapshots of the output of each problem query, and to name the file using a specified format. The 10 problems involve queries retrieving records based on various columns and conditions from the tables.

Uploaded by

Kumaran Mdl
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views7 pages

Kumaran Manangatti Dharman Lekha Assignment 6 - Introduction To SQL

The document provides instructions for an assignment involving SQL queries on 6 database tables: EMPLOYEE, DEPARTMENT, DEPT_LOCATIONS, WORKS_ON, PROJECT, and DEPENDENT. Students are asked to submit dumps of each table, the SQL for 10 problems, snapshots of the output of each problem query, and to name the file using a specified format. The 10 problems involve queries retrieving records based on various columns and conditions from the tables.

Uploaded by

Kumaran Mdl
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 7

Kumaran Manangatti Dharman Lekha

Assignment 6 Introduction to SQL


Submit the following:
1. A dump of each table in the database (6 tables);
2. The SQL required to complete each problem.
3. A snapshot of the output of each problem.
4. Please name the file using the following format: A6StudentName (use your name)

EMPLOYEE

DEPARTMENT

DEPT_LOCATIONS

WORKS_ON

PROJECT

DEPENDENT

Problem 1:
Display each record in the DEPT_LOCATIONS table. The heading of the columns should
be Dept Number for Dnumber and Dept Location for Dlocation.
SELECT Dnumber AS "Dept Number", Dlocation AS "Dept Location"
FROM DEPT_LOCATIONS;

Problem 2:
Using the employee table, extract the records where the individuals Dno is less than or equal to
4.
Display these columns
Fname using First Name
Lname using Last Name
Salary
Dno as Dept Number
SELECT Fname AS "First Name", Lname AS "Last Name", Salary, Dno AS "Dept Number"
from EMPLOYEE

where Dno <= 4;

Problem 3
Display all males earning at least 38000 in salary.
Show columns Fname, LName, Sex, Salary
SELECT Fname, Lname, Sex,Salary FROM
EMPLOYEE
WHERE sex = 'M'
AND salary >=38000;

Problem 4
Display all dependents whose name begins with the letter A.
Show columns Dependent_name, Sex, Relationship
SELECT Dependent_name, Sex, Relationship FROM DEPENDENT
WHERE DEPENDENT_NAME LIKE 'A%';

Problem 5
Select all dependents born in the 1980s.
Show columns Dependent_name, Bdate, Relationship
SELECT Dependent_name, Bdate, Relationship FROM DEPENDENT
WHERE Bdate >='01-01-80' AND
Bdate < '01-01-90';

Problem 6
Select all employees with an Ssn that contains a 3.
Display Fname (using FirstName), Lname (using FamilyName), SSN (using Social Security
Number)
SELECT Fname AS "Firstname", Lname AS "Familyname", Ssn AS "Social Security Number"
FROM EMPLOYEE

WHERE Ssn LIKE '%3%';

Problem 7
Extract all records in the WORKS_ON table with Hours greater than or equal 35.
Display all columns
SELECT *
FROM WORKS_ON
WHERE Hours >= 35;

Problem 8
Extract all records in the WORKS_ON table with Hours not between 20 and 40.
Display all columns
SELECT *
FROM WORKS_ON
WHERE Hours NOT BETWEEN 20 AND 40;

Problem 9
Select all dependents who are male spouses.
Show all columns.
SELECT * FROM DEPENDENT
WHERE Sex = 'M' AND
Relationship = 'Spouse';

Problem 10
Select all employees whose Ssn has a 4 as the 4th digit.
Show columns Lname and SSn.
SELECT Lname, Ssn
FROM EMPLOYEE
WHERE Ssn LIKE '___4%';

You might also like