linkedin-skill-assessments-quizzes

Transact-SQL (T-SQL)

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

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

Q3. What is the result of this series of statements?

BEGIN TRY
SELECT 'Foo' AS Result;
END TRY
BEGIN CATCH
SELECT 'Bar' AS Result;
END CATCH

Q4. Given these two tables, which query generates a listing showing student names and the department office location where you could reach each student?

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

Q6. Given the Games table pictured, which query generates the results shown?

Q7. Which answer is a possible result of the sequence of commands below?

DECLARE @UniqueID uniqueidentifier = NEWID();
SELECT @UniqueID AS Result;

Q8. You need to find all students that are not on the “Chemistry Cats” team. Which query does NOT work for this task?

Q9. 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?

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

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.

Q11. What is the result of this statement?

SELECT FLOOR(-1234.321)

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

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

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

Q15. What is the result of the following query? SELECT 1 / 2 AS Result;

Q16. which data type will most efficiently store a person’s age in years?

Q17. What is the result of this query?

SELECT 'abc\
def' AS Result;

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

https://www.petefreitag.com/item/466.cfm

Q19. What result is returned after executing the following commands?

DECLARE @MyVariable int;
SET @MyVariable = 1;
GO
SELECT @MyVariable;

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

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

Q22. 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______ ;

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

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

Q25. What does a RIGHT JOIN ensure?

Q26. You execute the following three queries. What is the result?

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;

Q27. Which Query returns all student names with the highest grade?

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.

Q28. What role does “inventory” play?

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

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

Q30. To remove all of the content from the Students table but keep the schema, which statement should you use?

Q31. Review the CREATE TABLE statement below. Which option, when placed in the blank space, ensures that the BookISBN column will not contain any duplicate values?

CREATE TABLE Books (
    BookID int PRIMARY KEY,
    BookISBN char(13) NOT NULL _____,
    BookTitle nvarchar(100) NOT NULL
);

Q32. Given a table with the following structure, which query will not return the lowest grade earned by any student?

GREATE 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

Q33. Given a table with the following structure, which query will not return the lowest grade earned by any student?

T-SQL-Q33