Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

FOR QUESTIONS 1-4: Given the following table named DEPT, DEPTNO DNAME LOC 10 20

ID: 662489 • Letter: F

Question

FOR QUESTIONS 1-4: Given the following table named DEPT,

DEPTNO

DNAME

LOC

10
20
30
40

ACCOUNTING
RESEARCH
SALES
OPERATIONS

NEW YORK
DALLAS
CHICAGO
BOSTON

Write an SQL script for the following returned data:

1.

DNAME

LOC

RESEARCH
SALES
OPERATIONS

DALLAS
CHICAGO
BOSTON

ANSWER:

2.

Great Seafood

BOSTON

ANSWER:

3.

LOC

NEW YORK
CHICAGO

ANSWER:

4.

DEPTNO

DNAME

LOC

40
30
20
10

OPERATIONS
SALES
RESEARCH
ACCOUNTING

BOSTON
CHICAGO
DALLAS
NEW YORK

ANSWER:

DEPTNO

DNAME

LOC

10
20
30
40

ACCOUNTING
RESEARCH
SALES
OPERATIONS

NEW YORK
DALLAS
CHICAGO
BOSTON

Explanation / Answer

If we want to write query from table we need more inforamtion or logic is required.

1) select DNAME, LOC from DPET where DNAME <> 'ACCOUNTING' (here <> is not);

# Could be possible multiple quaries

2) select LOC as Great Seafood from DEPT where DNAME='OPERATIONS';

3) select LOC from DEPT where DNAME = 'SALES' or DNAME= 'ACCOUNTING';

4) select * from DEPT order by DEPTNO desc;