Questions
With SQL, how do you select all the records from a table named "Persons" where the "FirstName" is "Peter" and the "LastName" is "Jackson"?
- SELECT * FROM Persons WHERE FirstName LIKE 'Peter' AND LastName LIKE 'Jackson'
- SELECT * FROM Persons WHERE FirstName='Peter' AND LastName='Jackson'
- SELECT FirstName='Peter', LastName='Jackson' FROM Persons
With SQL, how do you select all the records from a table named "Persons" where the "LastName" is alphabetically between (and including) "Hansen" and "Pettersen"?
- SELECT LastName>'Hansen' AND LastName<'Pettersen' FROM Persons
- SELECT * FROM Persons WHERE LastName BETWEEN 'Hansen' AND 'Pettersen'
- SELECT * FROM Persons WHERE LastName>'Hansen' AND LastName<'Pettersen'
Which SQL statement is used to return only different values?
- SELECT UNIQUE
- SELECT INDENTITY
- SELECT DIFFERENT
- SELECT DISTINCT
Which SQL keyword is used to sort the result-set?
- SORT BY
- ORDER
- ORDER BY
- SORT
With SQL, how can you return all the records from a table named "Persons" sorted descending by "FirstName"?
- SELECT * FROM Persons SORT BY 'FirstName' DESC
- SELECT * FROM Persons ORDER BY FirstName DESC
- SELECT * FROM Persons ORDER FirstName DESC
- SELECT * FROM Persons SORT 'FirstName' DESC
With SQL, how can you insert a new record into the "Persons" table?
- INSERT INTO Persons VALUES ('Jimmy', 'Jackson')
- INSERT ('Jimmy', 'Jackson') INTO Persons
- INSERT VALUES ('Jimmy', 'Jackson') INTO Persons
With SQL, how can you insert "Olsen" as the "LastName" in the "Persons" table?
- INSERT INTO Persons (LastName) VALUES ('Olsen')
- INSERT ('Olsen') INTO Persons (LastName)
- INSERT INTO Persons ('Olsen') INTO LastName
How can you change "Hansen" into "Nilsen" in the "LastName" column in the Persons table?
- UPDATE Persons SET LastName='Hansen' INTO LastName='Nilsen'
- UPDATE Persons SET LastName='Nilsen' WHERE LastName='Hansen'
- MODIFY Persons SET LastName='Hansen' INTO LastName='Nilsen
- MODIFY Persons SET LastName='Nilsen' WHERE LastName='Hansen'
With SQL, how can you delete the records where the "FirstName" is "Peter" in the Persons Table?
- DELETE FROM Persons WHERE FirstName = 'Peter'
- DELETE ROW FirstName='Peter' FROM Persons
- DELETE FirstName='Peter' FROM Persons
With SQL, how can you return the number of records in the "Persons" table?
- SELECT COLUMNS() FROM Persons
- SELECT COUNT(*) FROM Persons
- SELECT COLUMNS(*) FROM Persons
- SELECT COUNT() FROM Persons
What will be the output of the following statement? SELECT LEN(CAST(LEFT('026-100', 3) AS INT))
- 2
- 3
- 7
- Statement will generate an error.
What will be the output of the following statement? SELECT CAST(-1 AS SMALLDATETIME)
- 1900-01-01 00:00:00.000
- 1899-01-01 00:00:00.000
- 1752-01-01 00:00:00.000
- The system will generate an error. Only positive integer values can be converted to a SMALLDATETIME data type.
What will be the output of the following statement? SELECT ROUND(123.89, -1)
- 120.00
- 123.00
- 123.90
- 124.00
What will be the output of the following statement? SELECT STR(6365, 3)
- ***
- 6365
- 6,365
- 6400
- 6365.000
What will be the output of the following statement? SET ARITHABORT OFF SET ANSI_WARNINGS OFF SELECT 100/0
- Null
- 0
- Infinity
- An error is generated.
View text definitions are stored in which system table?
- sysobjects
- syscolumns
- syscomments
- sysviews
What's the maximum value can an INT data type hold?
- 2,147,483,647
- 2,147,483,648
- 4,294,967,295
- 4,294,967,296
What is the best data type to store the birthdays of the US Presidents, starting with George Washington's birthday of February 22, 1732?
- DATETIME
- INT
- SMALLDATETIME
- VARCHAR
Which of the following is NOT a valid description of the public role?
- The public role captures all default permissions for users in a database.
- The public role cannot be dropped.
- The public role is contained in every database, including msdb, tempdb, model, and all user databases except in the master database for security purposes.
- The public role cannot have users, groups, or roles assigned to it.
What is the maximum date value that can be stored in a SMALLDATETIME data type?
- June 6, 2079
- July 6, 2079
- December 31, 2079
- December 31, 9999