1.
nonclustered
2.
unique
3.
heap
4.
hash
Q 1 / 38
1.
joining operations
2.
linking operations
3.
criteria operations
4.
logical operations
Q 2 / 38
BEGIN TRY SELECT 'Foo' AS Result; END TRY BEGIN CATCH SELECT 'Bar' AS Result; END CATCH
1.
Foo
2.
FooBar
3.
Foo Bar
4.
Bar
Q 3 / 38
1.
SELECT Students.first_name, Students.last_name, Departments.office_location FROM Students, Departments;
2.
SELECT Students.first_name, Students.last_name, Departments.office_location FROM Students JOIN Departments ON Students.department = Departments.department;
3.
SELECT Students.first_name, Students.last_name, Departments.office_location FROM Students JOIN Departments;
4.
SELECT Students.first_name, Students.last_name, Departments.office_location FROM Students ON Students.department = Departments.department;
Q 4 / 38
1.
TRUNCATE TABLE
2.
DELETE
3.
MERGE
4.
DROP
Q 5 / 38
FROM Games GROUP BY MaxPlayers, GameType ORDER BY MaxPlayers, GameType; FROM Games GROUP BY GameType, MaxPlayers ORDER BY GameType; FROM Games GROUP BY GameType, MaxPlayers ORDER BY GameType; FROM Games GROUP BY GameType ORDER BY MaxPlayers;
1.
SELECT GameType, MaxPlayers, count(*) AS NumberOfGames
2.
SELECT GameType, MaxPlayers, count(*) AS NumberOfGames
3.
SELECT GameType, count(Players) AS MaxPlayers, NumberOfGames
4.
SELECT GameType, MaxPlayers, count(*) AS NumberOfGames
Q 6 / 38
DECLARE @UniqueID uniqueidentifier = NEWID(); SELECT @UniqueID AS Result;
1.
1
2.
bb261196-66a5-43af-815d-123fc593cf3a
3.
z350mpj1-62lx-40ww-9ho0-4u1875rt2mx4
4.
0x2400001155F04846674AD4590F832C0
Q 7 / 38
WHERE team NOT 'Chemistry Cats'; WHERE team <> 'Chemistry Cats'; WHERE team != 'Chemistry Cats'; WHERE NOT team = 'Chemistry Cats';
1.
SELECT * FROM Students
2.
SELECT * FROM Students
3.
SELECT * FROM Students
4.
SELECT * FROM Students
Q 8 / 38
1.
WHERE LastName = A*
2.
WHERE LastName = LIKE '%A%'
3.
WHERE LastName LIKE 'A%'
4.
WHERE LastName IN ('A*')
Q 9 / 38
`the picture of table is important here and there it can be seen that there are only two value with min points. Secondly, the previous answer was wrong because order by DESC will put highest points into the beginning of result list and TOP(2) will take first two highest points, and we need the lowest points.`
1.
SELECT LIMIT(2) first_name, department, team FROM Students ORDER BY points ASC;
2.
SELECT TOP(2) first_name, deprtment, team FROM Students ORDER BY points DESC;
3.
SELECT TOP(2) WITH TIES first_name, department, team FROM Students ORDER BY points;
4.
SELECT BOTTOM(2) first_name, department, team FROM Students ORDER BY points ASC;
Q 10 / 38
`SELECT FLOOR(-1234.321)`
1.
-1234.3
2.
-1234
3.
-1235
4.
1234.321
Q 11 / 38
1.
UPDATE Students SET last_name = 'Smith' WHERE email = 'dfiggins@rouxacademy.com';
2.
UPDATE Students SET last_name = 'Figgins' WHERE email = 'dfiggins@rouxacademy.com';
3.
UPDATE Students SET last_name = 'Figgins' WHERE last_name = 'Smith' AND first-name = 'Donette';
4.
UPDATE Students SET last_name = 'Smith' WHERE last_name = 'Figgins' AND first-name = 'Donette';
Q 12 / 38
1.
real
2.
bit
3.
decimal
4.
numeric
Q 13 / 38
1.
TRUNCATE FROM Products *;
2.
DELETE FROM Products;
3.
DELETE * FROM Products;
4.
TRUNCATE TABLE Products;
Q 14 / 38
1.
0.5
2.
error
3.
0
4.
2
Q 15 / 38
1.
float
2.
int
3.
tinyint
4.
bigint
Q 16 / 38
SELECT 'abc def' AS Result;
1.
abcdef
2.
abcdef
3.
error
4.
abc def
Q 17 / 38
1.
SELECT TOP(1) first_name, last_name FROM Students ORDER BY NEWID();
2.
SELECT TOP(1) RAND(first_name, last_name) FROM Student;
3.
SELECT TOP(1) first_name, last_name FROM Student;
4.
SELECT TOP(1) first_name, last_name FROM RAND(Student);
Q 18 / 38
DECLARE @MyVariable int; SET @MyVariable = 1; GO SELECT @MyVariable;
1.
error
2.
1
3.
null
4.
@MyVariable
Q 19 / 38
1.
ALTER USER Sharon WITH DEFAULT_SCHEMA = Sales;
2.
ALTER USER Sharon SET SCHEMA Sales;
3.
CREATE SCHEMA Sales SET OWNER Sharon;
4.
CREATE SCHEMA Sales AUTHORIZATION Sharon;
Q 20 / 38
1.
1024
2.
20
3.
0
4.
9
Q 21 / 38
SELECT ProductID, ProductName, SerialNumber FROM Products______ ; `The underscore will match any single character so you must bracket it to match a literal _, otherwise you could potentially return a serial number ending in '1013', for example.`
1.
`WHERE SerialNumer LIKE '%10_3'`
2.
`WHERE SerialNumer LIKE ('%10'+'_'+'3')`
3.
`WHERE SerialNumer LIKE '%10"_"3'`
4.
`WHERE SerialNumer LIKE '%10[_]3'`
Q 22 / 38
1.
INNER
2.
RIGHT
3.
LEFT
4.
FULL
Q 23 / 38
1.
1 byte
2.
2 bytes
3.
4 bytes
4.
8 bytes
Q 24 / 38
1.
that only records from the rightmost table will be displayed
2.
that no records from the rightmost table are displayed if the records dont have corresponding records in the left table
3.
that records from the rightmost table will be displayed only if the records have a corresponding value in the leftmost table
4.
that all records from the rightmost table are represented in the result, even if there are no corresponding records in the left table
Q 25 / 38
Create table students(id int identity(1000,1), firstname varchar(20), lastname varchar(30)); insert into students(firstname,lastname)values('mark','twain'); select * from students; studentid firstname lastname 1 1001 mark twain studentid firstname lastname 1 1 mark twain 1 1000 mark twain studentid firstname lastname 1 null mark twain
1.
undefined
2.
undefined
3.
undefined
Q 26 / 38
`create table students( studentname varchar(50), grade int);` `top(1) with ties will take the highest grade and all other students with the same grade (because they are order by grade) and matches the highest grade.`
1.
select studentname from students where grade=max(grade);
2.
select top(1) studentname from students order by grade;
3.
select top(1) with ties studentname from students order by grade desc;
4.
select studentname,max(grade) from students order by grade desc;
Q 27 / 38
`select bookid, boooktitle, bookauthor,quantityonhand from inventory.books;` `select * from dbo.books here dbo is a schema and the inventory is also schema; if we'd like to specify a database we should use db_name.schema_name.table_name`
1.
you only want to see results from books currently in inventory
2.
it instructs the query engine to find the books table in the inventory schema
3.
it instructs the query engine to find the books table in the inventory database
4.
it instructs the query engine to join the books table to the inventory schema
Q 28 / 38
1.
Only records that have corresponding entries in table1 and table2 are displayed.
2.
No records from table1 are ever displayed.
3.
All records from table1 are displayed, regardless of whether the records have a corresponding row in table2
4.
Only records that have no corresponding records in table1 or table2 are displayed.
Q 29 / 38
1.
TRUNCATE TABLE Students;
2.
TRUNCATE * FROM Students;
3.
DROP TABLE Students;
4.
REMOVE * FROM Students;
Q 30 / 38
CREATE TABLE Books ( BookID int PRIMARY KEY, BookISBN char(13) NOT NULL _____, BookTitle nvarchar(100) NOT NULL );
1.
NO DUPLICATES
2.
UNIQUE CONSTRAINT AK_Books_BookISBN
3.
DUPLICATE CONSTRAINT (AK_Books_BookISBN)
4.
CONSTRAINT AK_Books_BookISBN UNIQUE
Q 31 / 38
CREATE TABLE Students ( StudentName varchar(50), Grade int ); SELECT StudentName FROM Students WHERE Grade = (SELECT MIN(Grade) FROM Student); SELECT TOP(1) Grade FROM Students ORDER BY Grade; SELECT MIN(Grade) FROM Students ORDER BY Grade; SELECT MIN(Grade) FROM Students **Explanation:** `Column "Students.Grade" is invalid in the ORDER BY clause because it is not contained in either an aggregate function or the GROUP BY clause.`
1.
SELECT StudentName
FROM Students
WHERE Grade = (SELECT MIN(Grade) FROM Student);
2.
SELECT TOP(1) Grade
FROM Students
ORDER BY Grade;
3.
SELECT MIN(Grade)
FROM Students
ORDER BY Grade;
4.
SELECT MIN(Grade)
FROM Students
Q 32 / 38
![T-SQL-Q33](images/Q33.jpg)
1.
UPDATE Students SET last_name='Smith', email = 'dsmith@rouxacademy.com' WHERE id='56295';
2.
UPDATE Students SET last_name='Smith' AND email = 'dsmith@rouxacademy.com' WHERE id='56295';
3.
UPDATE Students SET last_name='Smith' AND email = 'dsmith@rouxacademy.com' WHERE id=56295;
4.
UPDATE Students SET last_name='Smith', email = 'dsmith@rouxacademy.com' WHERE id=56295;
Q 33 / 38
1.
You should create a DML trigger on the server.
2.
You should create a DDL trigger on the database.
3.
You should create a DML trigger on TableA.
4.
You should create a DML trigger on TableB.
Q 34 / 38
DECLARE @Counter int; SET @Counter = 1; WHILE @Counter > 0 BEGIN SET @Counter = @Counter +1; END;
1.
There is no END WHILE statement;
2.
The local varaible is not available to the WHILE block.
3.
The query causes an infinite loop.
4.
"Counter" is an invalid variable name.
Q 35 / 38
![T-SQL-Q36](images/Q36.jpg)
1.
UPDATES Students SET team = 'Philosophy Parrots' WHERE team = 'Philosophy Pandas';
2.
UPDATES Students SET team = `Philosophy Parrots` WHERE team = `Philosophy Pandas`;
3.
UPDATES Students SET team = "Philosophy Parrots" WHERE team = "Philosophy Pandas";
4.
UPDATES Students SET team = Philosophy Parrots WHERE team = Philosophy Pandas;
Q 36 / 38
`SELECT 123+'123' AS Result;`
1.
error
2.
'123''123'
3.
123123
4.
246
Q 37 / 38
1.
DEDUPE
2.
SELECT
3.
MERGE
4.
UNION
Q 38 / 38