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

DBMS

It is queries of SQl

Uploaded by

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

DBMS

It is queries of SQl

Uploaded by

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

1.

The command to eliminate a table from a database is:

A.REMOVE TABLE CUSTOMER;

B.DROP TABLE CUSTOMER;

C.DELETE TABLE CUSTOMER;

D.UPDATE TABLE CUSTOMER;

2. Which of the following is the correct order of keywords for SQL SELECT statements?

A.SELECT, FROM, WHERE

B.FROM, WHERE, SELECT

C.WHERE, FROM,SELECT

D.SELECT,WHERE,FROM

Answer: Option A

3. Which of the following are the five built-in functions provided by SQL?

A.COUNT, SUM, AVG, MAX, MIN

B.SUM, AVG, MIN, MAX, MULT

C.SUM, AVG, MULT, DIV, MIN

D.SUM, AVG, MIN, MAX, NAME

Answer: OptionA

4. The command to remove rows from a table 'CUSTOMER' is:

A.REMOVE FROM CUSTOMER ...

B.DROP FROM CUSTOMER ...

C.DELETE FROM CUSTOMER WHERE ...

D.UPDATE FROM CUSTOMER ...


Answer: Option C

5. The SQL WHERE clause:

A.limits the column data that are returned.

B.limits the row data are returned.

C.Both A and B are correct.

D.Neither A nor B are correct.

Answer: Option B

6. The SQL keyword BETWEEN is used:

A.for ranges.

B.to limit the columns displayed.

C.as a wildcard.

D.None of the above is correct.

Answer: Option A

7. Which one of the following sorts rows in SQL?

A.SORT BY

B.ALIGN BY

C.ORDER BY

D GROUP BY

Answer: Option C

8. Which of the following do you need to consider when you make a table in SQL?

A.Data types

B.Primary keys

C.Default values
D.All of the above.

Answer: Option D

9. Every time attribute A appears, it is matched with the same value of attribute B, but not the same
value of attribute C. Therefore, it is true that:

A . A → B.

B. A → C.

C. A → (B,C).

D. (B,C) → A.

Answer: Option A

10. Row is synonymous with the term:

A.record.

B.relation.

C.column.

D.field.

Answer: Option A

11. In the relational model, relationships between relations or tables are created by using:

A.composite keys.

B.determinants.

C.candidate keys.

D.foreign keys.

Answer: Option D

12. In SQL, what is the difference between CHAR and VARCHAR data types?

A. CHAR is fixed length, VARCHAR is variable length

B. CHAR is variable length, VARCHAR is fixed length

C. No difference

D. VARCHAR is used only for numeric data


Answer A

13. In SQL, what is the purpose of the TRUNCATE command?

A.Deletes specific rows from a table

B.Removes all rows from a table

C.Changes table structure

D.Creates a new table

Answer B

14. Identify the error in

"ALTER TABLE Students DROP COLUMN DateOfBirth date;"

A.ALTER TABLE

B.DROP COLUMN

C.DateOfBirth

D.date

Answer D

15. In the query "SELECT Name FROM Employees WHERE Age > 30 AND Department = 'HR';",

what needs to be corrected?

A.All Correct

B.The SELECT keyword

C.The WHERE clause

D.The AND operator

Answer A

16. What does the following code snippet do?

DELETE FROM STUDENTS

WHERE AGE = 16;

ROLLBACK;
A. Performs an undo operation on the delete operation.

B.Deletes the rows from the table where AGE = 16

C.Deletes the entire table

D.None of the above

17. What does the following code snippet do?

SELECT TOP 5 * FROM students;

A.Select the top 5 entries for all the columns in the students' table.

B.Select all the entries from the students' table other than the top 5 entries

C.Selects all entries from the student table except 5 random rows

D.None of the above

Answer A

18. SQL data definition commands make up a(n) ____ .

A.DDL

B.DML

C. HTML

D.XML

Answer: Option B

19. Which forms have a relation that contains information about a single entity?
a) 4NF
b) 2NF
c) 5NF
d) 3NF

Answer: D

20. Why the following statement is erroneous?

SELECT dept_name, ID, avg (salary)


FROM instructor
GROUP BY dept_name;
a) Dept_id should not be used in group by clause
b) Group by clause is not valid in this query
c) Avg(salary) should not be selected
d) None

Answer: A

21. This Query can be replaced by which one of the following?

SELECT name, course_id


FROM instructor, teaches
WHERE instructor_ID= teaches_ID;

a) Select name,course_id from teaches,instructor where instructor_id=course_id;


b) Select name, course_id from instructor natural join teaches;
c) Select name, course_id from instructor;
d) Select course_id from instructor join teaches;

Answer: B

22. SELECT * FROM employee WHERE salary>10000 AND dept_id=101;


Which of the following fields are displayed as output?
a) Salary, dept_id
b) Employee
c) Salary
d) All the field of employee relation

Answer: D

23. Which of the following statements contains an error?


a) Select * from emp where empid = 10003;
b) Select empid from emp where empid = 10006;
c) Select empid from emp;
d) Select empid where empid = 1009 and lastname = ‘GELLER’;

Answer: d

24 . In the given query which of the keyword has to be inserted?

INSERT INTO employee _____ (1002,Joey,2000);


a) Table
b) Values
c) Relation
d) Field

Answer: B
25. SELECT name ____ instructor name, course id
FROM instructor, teaches
WHERE instructor.ID= teaches.ID;
Which keyword must be used here to rename the field name?
a) From
b) Rename
c) As
d) Join

Answer: C

26. SELECT name


FROM instructor
WHERE dept name = ’Physics’
ORDER BY name;
By default, the order by clause lists items in ______ order.
a) Descending
b) Any
c) Same
d) Ascending

Answer: D

27. SELECT instructor.*


FROM instructor, teaches
WHERE instructor.ID= teaches.ID;
This query does which of the following operation?
a) All attributes of instructor and teaches are selected
b) All attributes of instructor are selected on the given condition
c) All attributes of teaches are selected on given condition
d) Only the some attributes from instructed and teaches are selected

Answer: B

28. The union operation is represented by


a) ∩
b) U
c) –
d) *

Answer: B

29. The intersection operator is used to get the _____ tuples.


a) Different
b) Common
c) All
d) Repeating

Answer: B

30. The union operation automatically __________ unlike the select clause.
a) Adds tuples
b) Eliminates unique tuples
c) Adds common tuples
d) Eliminates duplicate

Answer: d

You might also like