Database Exam 1 Solution
Database Exam 1 Solution
* Required
Name *
Track *
GIS
Civil
True
False
4
Referential integrity is a constrain on data stating that all its references are valid
(1 Point)
True
False
CREATE, TRUNCATE
CREATE, SELECT
GRANT, REVOKE
DROP, REVOKE
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
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.
UPDATE dependent
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 keeps the structure of the deleted table (if there is no WHERE condition) whereas
TRUNCATE removes the structure of the deleted table
10
SELECT name
FROM employee
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 ASC, Cost/unit DESC;
SELECT product_name, Cost/unit FROM product ORDER BY product_name DESC , Cost/unit DESC;
12
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
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
FROM employee
The query will return the total value of all salaries by adding them altogether
COUNT will proceed all salary values including the NULL values
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
A View can either have all the rows of a table or specific rows based on certain condition
A view is considered as a SQL statement stored in the database with an associated name
21
22
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
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.