30 Questions
In SQL, what does using a select statement in an insert query do?
Includes rows resulting from the selection in the insertion
Which SQL query deletes all tuples in the 'instructor' relation for instructors associated with a department located in the Watson building from the 'department' relation?
DELETE FROM instructor WHERE dept_name IN (SELECT dept_name FROM department WHERE building = 'Watson');
What keyword is used to update a specific attribute in a SQL update statement?
Set
In SQL update statements, what is useful in the set clause?
Scalar subqueries
How is the problem of ordering updates in multiple updates avoided in SQL?
Case
What is the correct format for SQL case statements?
CASE WHEN pred1...result1 WHEN pred2...result2...WHEN predn...
What is the purpose of the EXISTS keyword in SQL?
Checking if any row in the subquery meets the condition
Which SQL keyword is used to create a temporary relation?
With
When using SQL, how can you identify rows that do not meet a specified condition?
Applying NOT EXISTS twice
In SQL, which keyword will be true if all rows in the subquery fail to meet a certain condition?
All rows in the subquery fail the condition only
Which option correctly describes the purpose of the MIN function in SQL?
Finding the minimum value in a column
What is the main distinction between using AND and OR operators in SQL queries?
AND operator requires both conditions to be true, while OR requires either one to be true.
What should be done to avoid cascading of authorizations from the user?
Revoke select on department from Amit, Satoshi restrict
How can user role confusions be avoided when roles are revoked?
The privilege must be granted only by roles
What is the purpose of executing 'set role name' in a session?
To set a new role for the session
Which keyword can be used to indicate that revocation should cascade?
cascade
How does revoking with 'restrict' differ from 'cascade'?
'Restrict' prevents cascading revocation
What happens if a specified role has not been granted to the user when using 'set role name'?
'set role name' fails
What type of query language is Relational Algebra?
Procedural
Which of the following operations is NOT a fundamental operation in relational algebra?
None of the mentioned
How is the selection operation denoted in relational algebra?
Sigma (Greek)
In the select operation of relational algebra, where do predicates appear?
Predicates, relation
Which of the following is NOT a fundamental operation in relational algebra?
Natural join
What does the relational algebra operation 'rename' do?
Change the name of a relation
Which SQL query is used to find all courses taught in both the Fall 2009 semester and in the Spring 2010 semester?
SELECT course id FROM SECTION AS S WHERE semester = ’Fall’ AND YEAR= 2009 AND EXISTS (SELECT * FROM SECTION AS T WHERE semester = ’Spring’ AND YEAR= 2010 AND S.course id= T.course id);
Which SQL construct is used to test for the nonexistence of tuples in a subquery?
Not exists
What does the SQL query 'SELECT COUNT(DISTINCT ID) FROM takes WHERE (course id, sec id, semester, YEAR) IN (SELECT course id, sec id, semester, YEAR FROM teaches WHERE teaches.ID= 10101);' primarily aim to do?
Retrieve the distinct ID count from the 'takes' table based on certain conditions.
In the context of database management systems, what does the SQL 'salary > SOME (SELECT salary FROM instructor WHERE dept name = ’Biology’)' query mainly focus on?
Selecting salaries greater than any salary in the Biology department.
Which SQL query is used to find courses taught in the Spring 2010 semester?
(SELECT course id FROM SECTION WHERE semester = ’Spring’ AND YEAR= 2010)
What is the primary purpose of using 'Exists' in an SQL query?
To check for nonexistence of tuples.
Test your SQL query skills with this question about finding courses taught in both the Fall 2009 and Spring 2010 semesters. Choose the correct SQL query from the options provided.
Make Your Own Quizzes and Flashcards
Convert your notes into interactive study material.
Get started for free