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

Basic SQL Quiz - 2 Online Test

This document provides a 20 question multiple choice quiz on basic SQL concepts. The questions cover topics like SELECT statements, WHERE clauses, ORDER BY, INSERT, UPDATE, DELETE, aggregate functions and data type conversions. For each question, there are 4 possible answers but only one correct option is identified after submitting the answer. This quiz tests fundamental SQL skills.

Uploaded by

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

Basic SQL Quiz - 2 Online Test

This document provides a 20 question multiple choice quiz on basic SQL concepts. The questions cover topics like SELECT statements, WHERE clauses, ORDER BY, INSERT, UPDATE, DELETE, aggregate functions and data type conversions. For each question, there are 4 possible answers but only one correct option is identified after submitting the answer. This quiz tests fundamental SQL skills.

Uploaded by

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

1/18/23, 10:50 AM Basic SQL Quiz - 2 Online Test

SQL (/topics/2) /  Test your SQL fundamentals (/topics/2) /  Basic SQL Quiz - 2 /   0 (/quiz/128/favourites)  Share  Back
(https://www.facebook.co
app_id=182909316066094
sql-quiz-
2&redirect_uri=https://alie
sql-quiz-2)

Basic SQL Quiz - 2


Description: Basic SQL Quiz - 2

Number of Questions: 20

Created by: Aliensbrain Bot

Tags: sql (/tag/40/sql/quiz)

 Start the Quiz (/quiz_events?quiz_id=128)

1.

With SQL, how do you select all the records from a table named "Persons" where the "FirstName" is "Peter" and the "LastName" is
"Jackson"?
(/question/1166/with-sql-how-do-you-select-all-the-records-from-a-table-name) Attempted 20/20 Correct 0

 sql (/tag/40/sql/question)
‹ 1 2 3 4 5 6 7 8 9 10
A SELECT * FROM Persons WHERE FirstName LIKE 'Peter' AND LastName LIKE 'Jackson'

✓ B SELECT * FROM Persons WHERE FirstName='Peter' AND LastName='Jackson'

C SELECT FirstName='Peter', LastName='Jackson' FROM Persons

 Hide answer
Correct Option: B

Thanks for your feedback.

Ad choices

2. With SQL, how do you select all the records from a table named "Persons" where the "LastName" is alphabetically between (and
including) "Hansen" and "Pettersen"?
 sql (/tag/40/sql/question)

A SELECT LastName>'Hansen' AND LastName

✓ B SELECT * FROM Persons WHERE LastName BETWEEN 'Hansen' AND 'Pettersen'

C SELECT * FROM Persons WHERE LastName>'Hansen' AND LastName

 Hide answer
Correct Option: B

3. Which SQL statement is used to return only different values?


 sql (/tag/40/sql/question)

https://www.aliensbrain.com/quiz/128/basic-sql-quiz-2 1/6
1/18/23, 10:50 AM Basic SQL Quiz - 2 Online Test
A SELECT UNIQUE

B SELECT INDENTITY

C SELECT DIFFERENT

✓ D SELECT DISTINCT

 Hide answer
Correct Option: D

4. Which SQL keyword is used to sort the result-set?


 sql (/tag/40/sql/question)

A SORT BY

B ORDER

✓ C ORDER BY

D SORT

 Hide answer
Correct Option: C

5. With SQL, how can you return all the records from a table named "Persons" sorted descending by "FirstName"?
 sql (/tag/40/sql/question)

A SELECT * FROM Persons SORT BY 'FirstName' DESC

✓ B SELECT * FROM Persons ORDER BY FirstName DESC

C SELECT * FROM Persons ORDER FirstName DESC

D SELECT * FROM Persons SORT 'FirstName' DESC


Attempted 20/20 Correct 0

 Hide answer
‹ 1 2 3 4 5 6 7 8 9 10
Correct Option: B

6.

With SQL, how can you insert a new record into the "Persons" table?
(/question/1171/with-sql-how-can-you-insert-a-new-record-into-the-persons-ta)
 sql (/tag/40/sql/question)

✓ A INSERT INTO Persons VALUES ('Jimmy', 'Jackson')

B INSERT ('Jimmy', 'Jackson') INTO Persons

C INSERT VALUES ('Jimmy', 'Jackson') INTO Persons

 Hide answer
Correct Option: A

7. With SQL, how can you insert "Olsen" as the "LastName" in the "Persons" table?
 sql (/tag/40/sql/question)

✓ A INSERT INTO Persons (LastName) VALUES ('Olsen')

B INSERT ('Olsen') INTO Persons (LastName)

C INSERT INTO Persons ('Olsen') INTO LastName

 Hide answer
Correct Option: A

8. How can you change "Hansen" into "Nilsen" in the "LastName" column in the Persons table?
 sql (/tag/40/sql/question)

A UPDATE Persons SET LastName='Hansen' INTO LastName='Nilsen'

✓ B UPDATE Persons SET LastName='Nilsen' WHERE LastName='Hansen'

C MODIFY Persons SET LastName='Hansen' INTO LastName='Nilsen

D MODIFY Persons SET LastName='Nilsen' WHERE LastName='Hansen'

https://www.aliensbrain.com/quiz/128/basic-sql-quiz-2 2/6
1/18/23, 10:50 AM Basic SQL Quiz - 2 Online Test

 Hide answer
Correct Option: B

9. With SQL, how can you delete the records where the "FirstName" is "Peter" in the Persons Table?
 sql (/tag/40/sql/question)

✓ A DELETE FROM Persons WHERE FirstName = 'Peter'

B DELETE ROW FirstName='Peter' FROM Persons

C DELETE FirstName='Peter' FROM Persons

 Hide answer
Correct Option: A

10. With SQL, how can you return the number of records in the "Persons" table?
 sql (/tag/40/sql/question)

A SELECT COLUMNS() FROM Persons

✓ B SELECT COUNT(*) FROM Persons

C SELECT COLUMNS(*) FROM Persons

D SELECT COUNT() FROM Persons

 Hide answer
Correct Option: B

11. What will be the output of the following statement? SELECT LEN(CAST(LEFT('026-100', 3) AS INT))
Attempted 20/20 Correct 0
 sql (/tag/40/sql/question)

✓ A 2
‹ 1 2 3 4 5 6 7 8 9 10

B 3

C 7

D Statement will generate an error.

 Hide answer
Correct Option: A

12. What will be the output of the following statement? SELECT CAST(-1 AS SMALLDATETIME)
 sql (/tag/40/sql/question)

A 1900-01-01 00:00:00.000

B 1899-01-01 00:00:00.000

C 1752-01-01 00:00:00.000

✓ D The system will generate an error. Only positive integer values can be converted to a SMALLDATETIME data type.

 Hide answer
Correct Option: D

13.

What will be the output of the following statement? SELECT ROUND(123.89, -1)
(/question/1186/what-will-be-the-output-of-the-following-statement-select-ro)
 sql (/tag/40/sql/question)

✓ A 120.00

B 123.00

C 123.90

D 124.00

 Hide answer
Correct Option: A

https://www.aliensbrain.com/quiz/128/basic-sql-quiz-2 3/6
1/18/23, 10:50 AM Basic SQL Quiz - 2 Online Test

14. What will be the output of the following statement? SELECT STR(6365, 3)
 sql (/tag/40/sql/question)

✓ A
B 6365

C 6,365

D 6400

E 6365.000

 Hide answer
Correct Option: A

15. What will be the output of the following statement? SET ARITHABORT OFF SET ANSI_WARNINGS OFF SELECT 100/0
 sql (/tag/40/sql/question)

✓ A Null

B 0

C Infinity

D An error is generated.

 Hide answer
Correct Option: A

16. View text definitions are stored in which system table?


 sql (/tag/40/sql/question)

A sysobjects
Attempted 20/20 Correct 0
B syscolumns

✓ C syscomments ‹ 1 2 3 4 5 6 7 8 9 10

D sysviews

 Hide answer
Correct Option: C

17. What's the maximum value can an INT data type hold?
 sql (/tag/40/sql/question)

✓ A 2,147,483,647

B 2,147,483,648

C 4,294,967,295

D 4,294,967,296

 Hide answer
Correct Option: A

18.

What is the best data type to store the birthdays of the US Presidents, starting with George Washington's birthday of February 22,
1732?
(/question/1191/what-is-the-best-data-type-to-store-the-birthdays-of-the-us-)
 sql (/tag/40/sql/question)

A DATETIME

✓ B INT

C SMALLDATETIME

D VARCHAR

 Hide answer
Correct Option: B

https://www.aliensbrain.com/quiz/128/basic-sql-quiz-2 4/6
1/18/23, 10:50 AM Basic SQL Quiz - 2 Online Test

19. Which of the following is NOT a valid description of the public role?
 sql (/tag/40/sql/question)

A The public role captures all default permissions for users in a database.

B The public role cannot be dropped.

✓ C The public role is contained in every database, including msdb, tempdb, model, and all user databases except in the master database for security
purposes.

D The public role cannot have users, groups, or roles assigned to it.

 Hide answer
Correct Option: C

20. What is the maximum date value that can be stored in a SMALLDATETIME data type?
 sql (/tag/40/sql/question)

✓ A June 6, 2079

B July 6, 2079

C December 31, 2079

D December 31, 9999

 Hide answer
Correct Option: A

- Hide questions

 Share this quiz with your friends


Attempted 20/20 Correct 0
0 Comments Sort by Oldest

‹ 1 2 3 4 5 6 7 8 9 10

Add a comment...

Facebook Comments plugin

ADVERTISEMENT
Ad by

Report this ad

Ad choices

Find more quizzes from top tags

general knowledge (/tag/435/general-knowledge/quiz)

3600 Quizzes (/tag/435/general-knowledge/quiz) 119725 Questions (/tag/435/general-knowledge/question)

technology (/tag/268/technology/quiz)

307 Quizzes (/tag/268/technology/quiz) 36705 Questions (/tag/268/technology/question)

sports (/tag/437/sports/quiz)

961 Quizzes (/tag/437/sports/quiz) 19148 Questions (/tag/437/sports/question)

history (/tag/438/history/quiz)

1088 Quizzes (/tag/438/history/quiz) 13125 Questions (/tag/438/history/question)

biology (/tag/2585/biology/quiz)

https://www.aliensbrain.com/quiz/128/basic-sql-quiz-2 5/6

You might also like