You are on page 1of 6

SQL Homework 1.

1
1. The code below is a create-table statement.
A. State what each line in the statement does.
B. Include an example of the data that will go in each column.

CREATE TABLE MY_CONTACTS


(
LAST_NAME VARCHAR2(30),
FIRST_NAME VARCHAR2(20),
EMAIL VARCHAR2(50),
BIRTHDAY DATE,
PROFESSION VARCHAR2(50)
LOCATION VARCHAR2(50)
STATUS VARCHAR2(50)
INTERESTS VARCHAR2(100)
SEEKING VARCHAR2(100)
)

2. Based on your knowledge of the above question, inspect the statements below and iden-
tify what could be wrong with them.

A.
C.

D.

2. The next set of questions are all related to the table “Easy_Drinks” shown below:
What drink name(s) are the outputs of these scripts?
A.

B.

C.

D.

E.

F.

G.
H.

3. Using the “Easy_Drinks” table, write a select statement in 3 different ways with the
output/result being ‘Bull Frog’ all 3 times.
A.

B.

C.

4. Use the table “Emp” for the next set of questions:


A. Display all the information of the emp table.

B. Display unique jobs from emp table.

C. Display unique jobs from emp table.

D. List the details of the emps in asc order of their salaries.

E. List the details of the emps in asc order of the deptnos and desc of jobs.
F. Display all the unique job groups in the descending order

G. Display all the details of all 'Mgrs'

H. List the emps who has joined before 1981

I. List the Empno, Ename, Sal, Daily Sal of all Employees in the ASC order of AnnSal

J. Display the empno , ename, job, hiredate, exp of all Mgrs

K. List the empno, ename, sal, exp of all emps working for Mgr 7839.

L. Display the details of the emps whose Comm. Is more than their sal.

M. List the emps in the asc order of Designations

N. List the emps who are either ‘CLERK’ or ‘ANALYST’ in the desc order

You might also like