0% found this document useful (0 votes)
22 views

Database Exam 1 Solution

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views

Database Exam 1 Solution

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

Database SQL Quiz GIS & Civil

Covers Chapters 4 , 5 & 6 . Quiz Duration is 25 mins.

* Required

Name *

Track *

GIS

Civil

Each column has a Unique constrain is a Primary key


(1 Point)

True

False
4

Referential integrity is a constrain on data stating that all its references are valid
(1 Point)

True

False

DDL (Data Definition Language) contains:


(1 Point)

CREATE, TRUNCATE

CREATE, SELECT

GRANT, REVOKE

DROP, REVOKE

Consider the following SQL statement:

GRANT SELECT ON TABLE employee TO Gemy WITH GRANT OPTIONS;

(Choose all that apply)


(1 Point)

Gemy has the privilege to select from employee table

Gemy has the privilege to select and update from employee table

Gemy has the privilege to grant users select from employee table

Gemy has the privilege to grant users select from all tables in schema
7

Which is correct in regards to INSERT statement:


(1 Point)

Only when inserting dates values, they have to be written/inserted inside single quotes.

If values of certain columns inserted (not the entire columns of a table), you must consider the
order of writing columns names themselves.

In a table, you may specify which columns to insert in, regardless of constrains linked with any
column.

Evaluate the result of the following query:

UPDATE dependent

SET dependent_name = Ahmed Sameh

After running this query, the result is:


(1 Point)

The whole values of ‘dependent_name’ column will be changed to Ahmed Sameh

Only the records which have values of ‘dependent_name’ will be changed to Ahmed Sameh

Error!

Which is true in regard with the difference between DELETE and TRUNCATE:
(1 Point)

DELETE is a DDL command whereas TRUNCATE is a DML command

DELETE can have a WHERE condition but TRUNCATE not

DELETE keeps the structure of the deleted table (if there is no WHERE condition) whereas
TRUNCATE removes the structure of the deleted table
10

Evaluate the following code:

SELECT name

FROM employee

WHERE salary BETWEEN 2000 AND 5000 ;

The above code is equivalent to:


(1 Point)

SELECT name FROM employee WHERE salary > 2000 AND salary < 5000 ;

SELECT name FROM employee WHERE salary > 2000 OR salary < 5000 ;

SELECT name FROM employee WHERE salary >= 2000 AND salary < 5000 ;

SELECT name FROM employee WHERE salary > = 2000 AND salary <= 5000 ;

SELECT name FROM employee WHERE salary >= 2000 OR salary <= 5000 ;

11

Consider the following query running result, What is the right SQL code to performe
the result with this order:
(1 Point)

SELECT product_name, Cost/unit FROM product ORDER BY product_name DESC, Cost/unit DESC;

SELECT product_name, Cost/unit FROM product ORDER BY product_name, Cost/unit;

SELECT product_name, Cost/unit FROM product ORDER BY product_name ASC, Cost/unit DESC;
SELECT product_name, Cost/unit FROM product ORDER BY product_name DESC , Cost/unit DESC;

SELECT product_name, Cost/unit FROM product ORDER BY product_name;

12

What’s true regarding Inner Join between two tables:


(1 Point)

Retrieve all records from both tables

Retrieve only matched records between the two tables

None of the above

13

Full outer join considered as a mix between right and left outer joins besides inner join
(1 Point)

True

False

14

Which of the following self-join queries will return ‘emp-name’ and ‘supervisor-name’
related to each employee:
(1 Point)

SELECT FNAME, FNAME FROM employee AS emp, employee AS super WHERE emp.superssn=
super.ssn

SELECT FNAME, FNAME FROM employee AS emp, employee AS super WHERE super.superssn=
emp.ssn

SELECT emp.FNAME, super.FNAME FROM employee AS emp, employee AS super WHERE


emp.superssn= super.ssn
15

A subquery is a nested query used to return data that will be used in the main query as
a condition to further restrict the data to be retrieved
(1 Point)

True

False

16

SQL aliases are used to give a table or a column in a table a permanent name.
(1 Point)

True

False

17

Evaluate the query below:

SELECT MAX(ssn), COUNT(salary)

FROM employee

Which is true in regards with the above code:

(Choose all that apply)


(1 Point)

The query will return only one value for SSN

The query will return the total value of all salaries by adding them altogether

COUNT will proceed all salary values including the NULL values

Columns’ names in the result set will be not readable


18

Aggregate functions perform a calculation on a set of values, and return a single value.
In addition, they can used with the GROUP BY clause.
(1 Point)

True

False

19

Concerning the SQL clauses execution order; SELECT clause executed first, then
WHERE clause, and finally FROM clause
(1 Point)

True

False

20

Which is true about the database VIEWS:


(1 Point)

A view in SQL are kind of virtual table

A View can either have all the rows of a table or specific rows based on certain condition

A view can be simple or complex view

A view can restrict data access

A view is considered as a SQL statement stored in the database with an associated name

All of the above

21

Which is true about INDEXES in database :


(1 Point)
Defined on one column only

Accelerate the retrieval of records

They must be created by DBMS

22

Which of the following applied to GROUP BY and HAVING SQL clauses:


(Choose all that apply)
(1 Point)

GROUP BY is often used with aggregate functions to group the result set

HAVING is used to restrict the result set retrieved by GROUP BY, by applying certain condition/s

It’s not obligatory to write GROUP BY clause when using HAVING clause in a SQL statement

It’s not a must to use WHERE clause when using GROUP BY clause

Submit

Never give out your password. Report abuse

This content is created by the owner of the form. The data you submit will be sent to the form owner. Microsoft is not responsible
for the privacy or security practices of its customers, including those of this form owner. Never give out your password.

Powered by Microsoft Forms |


The owner of this form has not provided a privacy statement as to how they will use your response data. Do not provide personal
or sensitive information.
| Terms of use

You might also like