Quiz - 2 ( DQL, DDL, DML, Joins and Set

Quiz - 2 ( DQL, DDL, DML, Joins and Set

University

25 Qs

quiz-placeholder

Similar activities

PRACTICA SQL

PRACTICA SQL

University

20 Qs

Structured Query Language

Structured Query Language

University

25 Qs

DML

DML

University

25 Qs

SQL T2

SQL T2

University

23 Qs

SQL Select Quiz1

SQL Select Quiz1

University

23 Qs

OCR A Level Computer Science (H446) - Component 1.3.2 - Databases

OCR A Level Computer Science (H446) - Component 1.3.2 - Databases

11th Grade - University

28 Qs

Quiz Basis Data

Quiz Basis Data

University

25 Qs

Quiz Pengelompokan dan Kriteria Data

Quiz Pengelompokan dan Kriteria Data

University

30 Qs

Quiz - 2 ( DQL, DDL, DML, Joins and Set

Quiz - 2 ( DQL, DDL, DML, Joins and Set

Assessment

Quiz

Computers

University

Medium

Created by

ARUN R

Used 1+ times

FREE Resource

25 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

1. Consider the following SQL statement:

SELECT COUNT(*) FROM student WHERE age > (SELECT AVG(age) FROM student);

The query returns the count of students older than the average age.

The query returns an error because subqueries cannot be used in the WHERE clause.

The query returns the average age of students.

The query fails because COUNT(*) cannot be used with subqueries.

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will be the output of the following SQL query?

SELECT 10 / 0 FROM dual;

A) 0
B) NULL
C) Error: Division by zero
D) Infinity

0

NULL

Error: Division by zero

INFINITY

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

3. Which of the following constraints ensures that a column in a table cannot have NULL values?

UNIQUE

CHECK

NOT NULL

FOREIGN KEY

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

4. Consider the relational schema:

Employee (EmpID, Name, Age, Department, Salary, ManagerID)
If we need to retrieve the names of employees who earn more than their respective managers, which SQL query is CORRECT?

SELECT e.Name FROM Employee e, Employee m WHERE e.ManagerID = m.EmpID AND e.Salary > m.Salary;

SELECT Name FROM Employee WHERE Salary > ManagerID;

SELECT e.Name FROM Employee e JOIN Employee m ON e.ManagerID = m.EmpID WHERE e.Salary < m.Salary;

SELECT Name FROM Employee WHERE ManagerID > Salary;

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

5. Given the relation schema:

Flights (FlightNo, Source, Destination, Fare, AirlineID)
Which of the following SQL statements is incorrect?

SELECT DISTINCT Source FROM Flights;

SELECT * FROM Flights WHERE Fare = NULL;

SELECT * FROM Flights WHERE Fare IS NULL;

SELECT Source, Destination FROM Flights;

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following is NOT a DML statement?

INSERT


UPDATE

DELETE

CREATE

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

7. The difference between UNION and UNION ALL is that:




UNION does not remove duplicates, while UNION ALL does

UNION removes duplicates, while UNION ALL does not

UNION is faster than UNION ALL

Both give the same result in all cases

Create a free account and access millions of resources

Create resources
Host any resource
Get auto-graded reports
or continue with
Microsoft
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?