With DDL, you can create and remove tables, schemas, domains, indexes and views.
SELECT, INSERT and UPDATE are DCL commands.
GRANT and REVOKE are DML commands.
COMMIT and ROLLBACK are DCL commands.
Useful resources, Relational Set Operators
enggid int(4) name varchar(50) salary int(4)
You want to select the top 2 engineers in the decreasing order of their salaries, starting with the maximum salary. Which of the following SQL queries will fetch this data?
SELECT TOP 2 * FROM engineers ORDER BY max(salary) DESC
SELECT TOP 2 * FROM engineers ORDER BY salary DESC, GROUP BY salary
SELECT TOP 2 * FROM engineers GROUP BY salary DESC
SELECT TOP 2 * FROM engineers ORDER BY salary DESC
SELECT TOP 2 [name], salary FROM engineers ORDER BY salary DESC
Truncate is faster than Delete
Truncate is a DDL command
Truncate retains the identity of the table
Truncate cannot be rolled back
Truncate removes all rows from the table
select * from Orders where OrderID = (select OrderID from OrderItems where ItemQty > 50)
In the sub query, '*' should be used instead of 'OrderID'
The sub query can return more than one row, so, '=' should be replaced with 'in'
The sub query should not be in parenthesis
None of the above
You can create DDL triggers
You can create DML triggers
Both a and b are correct
Neither a nor b is correct
Useful resources, DML Triggers
Triggers can be created in Assemblies.
Useful resources, Create CLR Triggers
Errors and deadlocks can be handled by using stored procedures
Errors and deadlocks can be handled by using cursors
Errors and deadlocks can be handled by using Try and Catch constructs
Errors and deadlocks can be handled by using inline queries
Useful resources, Using TRY/CATCH to Resolve Deadlocks
The Correlated sub-query scans the whole table
Joins pick up the rows according to the condition of the queries
The Correlated sub-query creates a nested loop
The Correlated sub-query makes the statement complex
Both Primary key and Unique key enforce uniqueness
Primary keys create a clustered index by default
Both Primary key and Unique key don't allow NULL values
Unique keys create a non-clustered index by default
It is possible to have more than one Primary key in a table
Useful resources, PRIMARY KEY Constraints