MCQs > Database Management > Transact-SQL (T-SQL) MCQs > Basic Transact-SQL (T-SQL) MCQs

Basic Transact-SQL (T-SQL) MCQ

1. Which is the best approach to update the last name and email address of a student with ID 56295?

Answer

Correct Answer: UPDATE Students SET last_name='Smith', email = 'dsmith@rouxacademy.com' WHERE id=56295;

Note: This Question is unanswered, help us to find answer for this one

2. Though not currently a requirement, what will a future release of SQL Server require of all SQL statements?Though not currently a requirement, what will a future release of SQL Server require of all SQL statements?

Answer

Correct Answer: All statements must end with a semicolon.

Note: This Question is unanswered, help us to find answer for this one

3. You need to create a simple database backup in the server's Z:\Backups directory. Which query should you use?

Answer

Correct Answer: BACKUP DATABASE MyDatabase TO DISK = 'z:\Backups\MyDatabase.bak';

Note: This Question is unanswered, help us to find answer for this one

4. Your database currently has a table called Inventory in the Warehouse schema. You need to move the table to the Products schema. Which query accomplishes this goal?

Answer

Correct Answer: ALTER SCHEMA Products TRANSFER Warehouse.Inventory;

Note: This Question is unanswered, help us to find answer for this one

5. To combine the results of two or more SELECT statements, removing duplicates, which keyword can you use?

Answer

Correct Answer: UNION

Note: This Question is unanswered, help us to find answer for this one

6. What is the result of this query? SELECT 123+'123' AS Result;

Answer

Correct Answer: 246

Note: This Question is unanswered, help us to find answer for this one

7. You would like to have a record added to a TableB every time a record is modified in TableA. What technique should you look at implementing?

Answer

Correct Answer: You should create a DML trigger on TableA.

Note: This Question is unanswered, help us to find answer for this one

8. What is the result of an INNER JOIN between table1 and table2?

Answer

Correct Answer: Only records that have corresponding entries in table1 and table2 are displayed.

Note: This Question is unanswered, help us to find answer for this one

9. Given a table with the following structure, which query returns all student names with the highest grade? CREATE TABLE Students (StudentName varchar(50),Grade int );

Answer

Correct Answer: SELECT TOP(1) WITH TIES StudentName FROM Students ORDER BY Grade DESC;

Note: This Question is unanswered, help us to find answer for this one

10. What does a RIGHT JOIN ensure?

Answer

Correct Answer: That all records from the rightmost table are represented in the result, even if there are no corresponding records in the left table

Note: This Question is unanswered, help us to find answer for this one

11. How many bytes of storage does the int data type consume?

Answer

Correct Answer: 4 bytes

Note: This Question is unanswered, help us to find answer for this one

12. When no join type between multiple tables in a query's FROM clause is specified, what type of join is assumed?

Answer

Correct Answer: INNER

Note: This Question is unanswered, help us to find answer for this one

13. You need to write a query that returns all products that have a SerialNumber ending with "10_3". Which WHERE clause should you use to fill in the blank in this query?SELECT ProductID, ProductName, SerialNumber FROM Products______ ;

Answer

Correct Answer: WHERE SerialNumer LIKE '%10_3'

Note: This Question is unanswered, help us to find answer for this one

14. The result of a CROSS JOIN between a table with 4 rows, and one with 5 rows, will give with _ rows.

Answer

Correct Answer: 20

Note: This Question is unanswered, help us to find answer for this one

15. Which statement creates a new database schema named Sales and establish Sharon as the owner?

Answer

Correct Answer: CREATE SCHEMA Sales AUTHORIZATION Sharon;

Note: This Question is unanswered, help us to find answer for this one

16. To select a random student from the table, which statement could you use?

Answer

Correct Answer: SELECT TOP(1) first_name, last_name FROM Students ORDER BY NEWID();

Note: This Question is unanswered, help us to find answer for this one

17. What is the result of this query? SELECT 'abc\ def' AS Result;

Answer

Correct Answer: abcdef

Note: This Question is unanswered, help us to find answer for this one

18. Which data type will most efficiently store a person's age in years?

Answer

Correct Answer: Tinyint

Note: This Question is unanswered, help us to find answer for this one

19. What is the result of this query? SELECT 1 / 2 AS Result;

Answer

Correct Answer: 0

Note: This Question is unanswered, help us to find answer for this one

20. You need to remove all data from a table name Products. Which query fully logs the removal of each record?

Answer

Correct Answer: DELETE FROM Products;

Note: This Question is unanswered, help us to find answer for this one

21. Which of these data types is an approximate numeric?

Answer

Correct Answer: Real

Note: This Question is unanswered, help us to find answer for this one

22. Which is the best approach to update the last name of the student Donette Figgins to Smith

Answer

Correct Answer: UPDATE Students SET last_name = 'Smith' WHERE last_name = 'Figgins' AND first-name = 'Donette';

Note: This Question is unanswered, help us to find answer for this one

23. What is the result of this statement?

Answer

Correct Answer: -1235

Note: This Question is unanswered, help us to find answer for this one

24. Which query shows the first name, department, and team of all students with the two lowest points?

Answer

Correct Answer: SELECT TOP(2) WITH TIES first_name, department, team FROM Students ORDER BY points;

Note: This Question is unanswered, help us to find answer for this one

25. You need to write a query that returns all Employees that have a LastName starting with the letter A. Which WHERE clause should you use to fill in the blank in this query?

Answer

Correct Answer: WHERE LastName LIKE 'A%'

Note: This Question is unanswered, help us to find answer for this one

26. What is an example of a DDL command in SQL?

Answer

Correct Answer: DROP

Note: This Question is unanswered, help us to find answer for this one

27. The keywords AND, IN, LIKE, and between all belong to a category called what?

Answer

Correct Answer: Logical operations

Note: This Question is unanswered, help us to find answer for this one

28. Which answer is NOT a type of table index?

Answer

Correct Answer: Heap

Note: This Question is unanswered, help us to find answer for this one

search
Transact-SQL (T-SQL) Subjects