Basic Structure of T-SQL
Which statement represents a correctly written T-SQL SELECT query that retrieves all columns from a table named Employees?
- SELECT * FROM Employees;
- GET ALL FROM Employees;
- FETCH Employees *;
- SELECT Employees ALL;
- SHOW * IN Employees;
Role of T-SQL
What is the primary purpose of T-SQL in a relational database environment?
- To query and manage data
- To create network protocols
- To design hardware drivers
- To format spreadsheets
- To analyze JSON files
Filtering Data
In T-SQL, which clause is used to filter rows in the result set based on a specific condition?
- WHERE
- WHEN
- WHILE
- WITHIN
- WHARE
Aggregate Functions
Which T-SQL aggregate function should you use to calculate the total number of rows in a Products table?
- COUNT
- SUMM
- TOTAL
- ADDS
- COUNTT
Sorting Query Results
How can you sort query results in ascending order by the LastName column in T-SQL?
- ORDER BY LastName ASC
- SORT LastName UP
- ORDER LastName UPWARDS
- SORT BY LastName ASCND
- ORDER LastName ASCENDING
Inserting Data
Which T-SQL command is used to add a new row into the Customers table?
- INSERT INTO Customers
- ADD INTO Customers
- APPEND Customers
- INJECT INTO Customers
- INSERT Customers IN
T-SQL Variable Declaration
How do you correctly declare a variable of type INTEGER in T-SQL?
- DECLARE @varName INT;
- DEFINE varName INTEGER;
- VAR @varName AS INT;
- SET @varName: INT;
- DECLAR @varName INTEGER;
Updating Data
To change the value of a column named 'Salary' to 50000 for all employees, which T-SQL command should you use?
- UPDATE Employees SET Salary = 50000;
- CHANGE Employees Salary TO 50000;
- MODIFY Employees Salary = 50000;
- SET Employees: Salary = 50000;
- UPDATE Salary = 50000 IN Employees;
Deleting Data
Which T-SQL statement removes all rows from the Orders table?
- DELETE FROM Orders;
- REMOVE Orders ALL;
- ERASE Orders;
- CLEAR ALL FROM Orders;
- DEL Orders;
Joining Tables
Which type of T-SQL JOIN returns all rows from the first table and matching rows from the second table?
- LEFT JOIN
- INNER JOIN
- RIGHT JOIN
- CROSS JOIN
- SIDE JOIN