Pregunta 1
Pregunta
Microsoft SQL Server is a [blank_start]one to many[blank_end] relational database system, which includes a [blank_start]one to one[blank_end] relationship as well.
Pregunta 2
Pregunta
The MDF file type holds the raw data for the database.
Pregunta 3
Pregunta
The [blank_start]LDF[blank_end] file type is the log file that holds transactions.
Pregunta 4
Pregunta
It is best practice for the MDF and LDF files to be stored on separate disk volumes if possible.
Pregunta 5
Pregunta
There are two types of indexes within SQL Server, one is [blank_start]clustered[blank_end], the other is [blank_start]non clustered[blank_end].
Pregunta 6
Pregunta
By default, the [blank_start]primary key[blank_end] is a clustered index.
Pregunta 7
Pregunta
Check off what is TRUE about a non clustered index within SQL Server:
Respuesta
-
Creates an index of the column OUTSIDE of the table.
-
A RID (RecordID) is stored in the index and is used to point back to a specific record within the table.
-
A non clustered index can be sorted without resorting the rest of the columns within the table.
-
A non clustered index is created by default.
Pregunta 8
Pregunta
Only one clustered index can exist on a single [blank_start]table[blank_end].
Pregunta 9
Pregunta
You can have as many non-clustered indexes in a table as you have [blank_start]columns[blank_end].
Pregunta 10
Pregunta
What type of SERVER-LEVEL roles will Microsoft SQL Server support? Check all that apply.
Respuesta
-
sysadmin
-
serveradmin
-
securityadmin
-
dbcreator
-
public
-
db_owner
-
db_datareader
Pregunta 11
Pregunta
What type of DATABASE-LEVEL roles will Microsoft SQL Server support? Check all that apply.
Respuesta
-
db_owner
-
db_securityadmin
-
db_datareader
-
db_backupoperator
-
db_datawriter
Pregunta 12
Pregunta
Indexes are sorted using a [blank_start]Balanced Tree[blank_end].
Pregunta 13
Pregunta
Label the three levels in the image:
Pregunta 14
Pregunta
Assume we want to add a user called James into the B-Tree. What would have to be done?
Respuesta
-
Perform a page split then add James
-
Add James after Hart with no page split
-
Add James at the intermediate level
-
Start a new B-Tree
Pregunta 15
Pregunta
When is the most ideal situation to use a B-Tree?
Respuesta
-
If you have a table with lots of updates occurring.
-
If you have a table with many reads but very few writes.
-
If you have a table column containing multiple records with the same data.
Pregunta 16
Pregunta
What is a "Commit"?
Respuesta
-
The data cached on the SQL server is saved to the transaction log file (the LDF file).
-
Data is cached onto the SQL server when changes in the database are made.
-
Any change that is made to a table within your database.
Pregunta 17
Pregunta
What is a "Checkpoint"?
Respuesta
-
Writes committed transactions to the database.
-
A read-only buffer cache.
-
Modifies records within tables.
Pregunta 18
Pregunta
A Simple Recovery model does not permanently keep transaction logs.
Pregunta 19
Pregunta
A Full Recovery model keeps the transaction logs, meaning they can be used in a restore.
Pregunta 20
Pregunta
The drawbacks of a Full Recovery model are: (check all that apply).
Respuesta
-
They take up more disk space than a Simple Recovery
-
When the transaction log file becomes full the SQL server will stop working
-
You need RAID5 to use the Full Recovery model.
Pregunta 21
Pregunta
Which SQL statement will you use to add a table called tblFuck within your database?
[blank_start]CREATE TABLE tblFuck[blank_end]
Pregunta 22
Pregunta
Match each Constraint with the appropriate Data Integrity Type:
Default Constraint: [blank_start]Domain[blank_end]
Check Constraint: [blank_start]Domain[blank_end]
Foreign Key Constraint: [blank_start]Referential[blank_end]
Unique Constraint: [blank_start]Entity[blank_end]
Primary Key Constraint: [blank_start]Entity[blank_end]
Respuesta
-
Domain
-
Referential
-
Entity
-
Domain
-
Referential
-
Entity
-
Referential
-
Domain
-
Entity
-
Entity
-
Domain
-
Referential
-
Entity
-
Domain
-
Referential
Pregunta 23
Pregunta
Fill in the following SQL statement to show all items with a price ranging from and including $100, and ranging less than and including $200.
[blank_start]SELECT[blank_end] Name [blank_start]from[blank_end] tblProducts [blank_start]WHERE[blank_end] Price [blank_start]>= 100[blank_end] [blank_start]AND[blank_end] Price [blank_start]<= 200[blank_end]
Respuesta
-
SELECT
-
from
-
WHERE
-
>= 100
-
AND
-
<= 200
Pregunta 24
Pregunta
Add a column called Departments with varchar of 50 to the table tblStaff:
[blank_start]ALTER[blank_end] [blank_start]TABLE[blank_end] tblStaff [blank_start]ADD[blank_end] Departments [blank_start]varchar(50)[blank_end]
Respuesta
-
ALTER
-
ADD
-
varchar(50)
-
TABLE
Pregunta 25
Pregunta
Remove a column called Departments from the tblStaff table.
[blank_start]ALTER[blank_end] [blank_start]TABLE[blank_end] tblStaff [blank_start]DROP[blank_end] [blank_start]COLUMN[blank_end] Departments
Pregunta 26
Pregunta
What is the proper naming convention for constraints?
[blank_start]CK_ConstraintName[blank_end] - For CHECK Constraint
[blank_start]PK_ConstraintName[blank_end] - For PRIMARY KEY Constraint
[blank_start]FK_ConstraintName[blank_end] - For FOREIGN KEY Constraint
[blank_start]DF_ConstraintName[blank_end] - For DEFAULT Constraint
[blank_start]U_ConstraintName[blank_end] - For UNIQUE Constraint
Respuesta
-
CK_ConstraintName
-
PK_ConstraintName
-
FK_ConstraintName
-
DF_ConstraintName
-
U_ConstraintName
-
CK_ConstraintName
-
PK_ConstraintName
-
FK_ConstraintName
-
DF_ConstraintName
-
U_ConstraintName
-
CK_ConstraintName
-
PK_ConstraintName
-
FK_ConstraintName
-
DF_ConstraintName
-
U_ConstraintName
-
CK_ConstraintName
-
PK_ConstraintName
-
FK_ConstraintName
-
DF_ConstraintName
-
U_ConstraintName
-
CK_ConstraintName
-
PK_ConstraintName
-
FK_ConstraintName
-
DF_ConstraintName
-
U_ConstraintName
Pregunta 27
Pregunta
A transaction started before and committed after a checkpoint.
Then a system failure occurred.
When the system comes back online, what would occur?
Pregunta 28
Pregunta
A transaction started and committed before a checkpoint.
Then a system failure occurred.
What is required?
Respuesta
-
No action is required.
-
A roll back.
-
A roll forward.
-
The data is corrupt.
Pregunta 29
Pregunta
A transaction started before the checkpoint.
It never fully committed at the time of the crash.
What action is required?
Pregunta 30
Pregunta
Fill in the blank so that only records where the Country is Canada are displayed.
SELECT *
FROM tblWhatever
[blank_start]WHERE[blank_end] Country = [blank_start]'Canada'[blank_end]
Pregunta 31
Pregunta
Fill in the blanks for the statement so that it displays results from Detroit, USA.
[blank_start]SELECT[blank_end] City, Country
[blank_start]FROM[blank_end] Locations
[blank_start]WHERE[blank_end] Country = [blank_start]'USA'[blank_end] [blank_start]AND[blank_end] City = [blank_start]'Detroit'[blank_end]
[blank_start]ORDER[blank_end] [blank_start]BY[blank_end] Country, City
Respuesta
-
SELECT
-
FROM
-
WHERE
-
'USA'
-
AND
-
'Detroit'
-
ORDER
-
BY
Pregunta 32
Pregunta
Fill in the statements so that it will return records where the country is either USA or Canada.
[blank_start]SELECT[blank_end] City, Country
[blank_start]FROM[blank_end] Locations
[blank_start]WHERE[blank_end] Country = [blank_start]'USA'[blank_end] [blank_start]OR[blank_end] Country = [blank_start]'Canada'[blank_end]
ORDER BY Country, City
Respuesta
-
SELECT
-
FROM
-
WHERE
-
'USA'
-
OR
-
'Canada'
Pregunta 33
Pregunta
Fill in the blanks so that tblStaff and tblDept are joined by the Name column.
[blank_start]SELECT[blank_end] [blank_start]tblStaff.Name[blank_end], [blank_start]tblDept.Name[blank_end]
[blank_start]FROM[blank_end] [blank_start]tblStaff[blank_end]
[blank_start]JOIN[blank_end] [blank_start]tblDept[blank_end]
[blank_start]ON[blank_end] [blank_start]tblStaff.ID_Dept[blank_end] [blank_start]=[blank_end] [blank_start]tblDept.ID_Dept[blank_end]
Respuesta
-
SELECT
-
tblStaff.Name
-
tblDept.Name
-
FROM
-
tblStaff
-
JOIN
-
tblDept
-
ON
-
tblDept.ID_Dept
-
tblStaff.ID_Dept
-
=
Pregunta 34
Pregunta
Fill in the blank to complete the SQL statement; so that it will return the average unit price.
[blank_start]SELECT[blank_end] [blank_start]avg[blank_end]([blank_start]unitprice[blank_end])
[blank_start]FROM[blank_end] [blank_start]tblOrders[blank_end]
Respuesta
-
SELECT
-
avg
-
unitprice
-
FROM
-
tblOrders
Pregunta 35
Pregunta
Write a SQL statement that will return the number of clients who live in London.
[blank_start]SELECT[blank_end] [blank_start]COUNT[blank_end]([blank_start]*[blank_end]) [blank_start]FROM[blank_end] [blank_start]tblLocations[blank_end] [blank_start]WHERE[blank_end] [blank_start]City[blank_end] [blank_start]=[blank_end] [blank_start]'London'[blank_end]
Respuesta
-
SELECT
-
COUNT
-
*
-
FROM
-
WHERE
-
'London'
-
City
-
=
-
tblLocations
Pregunta 36
Pregunta
Complete the SQL statement shown below so that you will show the total with 13% tax on the Cost and Quantity in a column labeled 'Total'.
[blank_start]SELECT[blank_end] [blank_start]Cost[blank_end] [blank_start]*[blank_end] [blank_start]Quantity[blank_end] [blank_start]*[blank_end] [blank_start]1.13[blank_end] [blank_start]'Total'[blank_end]
[blank_start]FROM[blank_end] [blank_start]tblOrders[blank_end]
Respuesta
-
SELECT
-
Cost
-
*
-
Quantity
-
*
-
1.13
-
'Total'
-
FROM
-
tblOrders
Pregunta 37
Pregunta
Will this query run successfully?
SELECT FirstName, LastName
FROM tblEmployees
GROUP BY FirstName
Respuesta
-
This will fail, as LastName is neither an aggregate function or included in the group by.
-
There is no problem with this query.
-
This will fail as the Group By clause is incorrect.
-
This will fail as FirstName is neither an aggregate function or included in the group by.
Pregunta 38
Pregunta
Will this query run successfully?
SELECT ProductName, SUM(UnitPrice), SUM(Cost), UnitPrice * Cost
FROM Orders
GROUP BY ProductName
Respuesta
-
This will fail as SUM(UnitPrice) and SUM(Cost) are aggregate functions and cannot be used with a Group By Clause.
-
This command will run successfully.
-
This will fail as ProductName cannot be used with the Group By Clause.
-
This will fail as UnitPrice * Cost is not an aggregate function and cannot be used with a Group By Clause.
Pregunta 39
Pregunta
What is true about views? Select all that apply.
Respuesta
-
You can insert data into a view.
-
You cannot join a table and a view together.
-
You can use a view to denormalize data.
-
You can define permissions for a view.
Pregunta 40
Pregunta
[blank_start]ALTER[blank_end] [blank_start]VIEW[blank_end] [blank_start]vEmployees[blank_end] [blank_start]AS[blank_end] [blank_start]Select[blank_end] [blank_start]ID_EMP[blank_end], [blank_start]FirstName[blank_end], [blank_start]LastName[blank_end] [blank_start]FROM[blank_end] [blank_start]Employees[blank_end]
Respuesta
-
ALTER
-
VIEW
-
vEmployees
-
AS
-
Select
-
ID_EMP
-
FirstName
-
LastName
-
FROM
-
Employees
Pregunta 41
Pregunta
What is true about stored procedures? Check all that apply.
Respuesta
-
You cannot alter (modify) a stored procedure.
-
A Stored Procedure can contain multiple SQL Statements.
-
You must use a BEGIN and END around your SQL statements within a stored procedure if you have multiple SQL statements.
-
Applications can use stored procedures to prevent against SQL injection
-
You must use a GO between each SQL statement.
Pregunta 42
Pregunta
Fill in the blanks that will complete the SQL statement used to create a stored procedure named USP_ViewEmp.
[blank_start]CREATE[blank_end] [blank_start]PROCEDURE[blank_end] [blank_start]USP_ViewEmp[blank_end]
[blank_start]AS[blank_end]
[blank_start]BEGIN[blank_end]
SELECT FirstName, LastName FROM tblEmployees
SELECT DeptName FROM tblDepartments
[blank_start]END[blank_end]
[blank_start]GO[blank_end]
Respuesta
-
CREATE
-
PROCEDURE
-
USP_ViewEmp
-
AS
-
BEGIN
-
END
-
GO
Pregunta 43
Pregunta
Which of the following help ensure data integrity?
Select all that apply.
Pregunta 44
Pregunta
What is the command to alter a table to add a constraint to the salary column in the employees table so the max salary is $100,000?
Ensure you use proper naming conventions.
[blank_start]ALTER[blank_end] [blank_start]TABLE[blank_end] Employee
[blank_start]ADD[blank_end] [blank_start]CONSTRAINT[blank_end] [blank_start]CK_Salary[blank_end]
[blank_start]CHECK[blank_end] ([blank_start]Salary[blank_end] [blank_start]<=[blank_end] [blank_start]100000[blank_end])
Respuesta
-
ALTER
-
TABLE
-
ADD
-
CONSTRAINT
-
CK_Salary
-
CHECK
-
Salary
-
<=
-
100000
Pregunta 45
Pregunta
Assuming proper naming convention was followed. What is the SQL statement to temporarily disable the check constraint for the Salary column in the employees table?
[blank_start]ALTER[blank_end] [blank_start]TABLE[blank_end] [blank_start]Employees[blank_end] [blank_start]NOCHECK[blank_end] [blank_start]CONSTRAINT[blank_end] [blank_start]CK_Salary[blank_end]
Respuesta
-
ALTER
-
TABLE
-
Employees
-
NOCHECK
-
CONSTRAINT
-
CK_Salary
Pregunta 46
Pregunta
When creating a database using SQL statements, type the line for the option to specify a data file in this location: C:\DATA\Acme.mdf.
Ensure you put a space before and after the equal sign.
[blank_start]FILENAME = 'C:\DATA\Acme.mdf'[blank_end]
Only write out the single line for this option.
Pregunta 47
Pregunta
When creating a database using a SQL command, what is the line that would specify the option to auto grow the data file by 50%?
[blank_start]FILEGROWTH = 50%[blank_end]
Pregunta 48
Pregunta
Create a table named tblStaff with the following columns:
• ID_Staff INT PRIMARY KEY
• FirstName varchar(50) Do not allow null values
• LastName varchar(50) Do not allow null values
• Extension varchar(4) Allow null values
[blank_start]CREATE[blank_end] [blank_start]TABLE[blank_end] tblStaff
(
[blank_start]ID_Staff[blank_end] [blank_start]INT[blank_end] [blank_start]PRIMARY[blank_end] [blank_start]KEY[blank_end],
[blank_start]FirstName[blank_end] [blank_start]varchar(50)[blank_end] [blank_start]NOT NULL[blank_end],
[blank_start]LastName[blank_end] [blank_start]varchar(50)[blank_end] [blank_start]NOT NULL[blank_end],
[blank_start]Extension[blank_end] [blank_start]varchar(4)[blank_end]
)
Respuesta
-
CREATE
-
TABLE
-
ID_Staff
-
INT
-
PRIMARY
-
KEY
-
FirstName
-
varchar(50)
-
NOT NULL
-
LastName
-
varchar(50)
-
NOT NULL
-
varchar(4)
-
Extension
Pregunta 49
Pregunta
Below is a snippet of a Create Table SQL statement.
ID_Staff int
Re-write this line so it has an identity specification with a seed of 1 and an increment of 1.
[blank_start]ID_Staff int IDENTITY (1, 1)[blank_end]
Pregunta 50
Pregunta
What is the SQL statement to alter the table tblStaff to add a column named Departments with a datatype of varchar(50)?
[blank_start]ALTER[blank_end] [blank_start]TABLE[blank_end] tblStaff [blank_start]ADD[blank_end] [blank_start]Departments[blank_end] [blank_start]varchar(50)[blank_end]
Respuesta
-
ALTER
-
TABLE
-
ADD
-
Departments
-
varchar(50)
Pregunta 51
Pregunta
What is the SQL Statement to remove the column named Departments from tblStaff?
[blank_start]ALTER[blank_end] [blank_start]TABLE[blank_end] tblStaff [blank_start]DROP[blank_end] [blank_start]COLUMN[blank_end] [blank_start]Departments[blank_end]
Respuesta
-
ALTER
-
TABLE
-
DROP
-
COLUMN
-
Departments
Pregunta 52
Pregunta
What is the SQL Statement to change the data type of the column firstname from varchar(50) to varchar(25) in tblStaff?
[blank_start]ALTER[blank_end] [blank_start]TABLE[blank_end] [blank_start]tblStaff[blank_end] [blank_start]ALTER[blank_end] [blank_start]COLUMN[blank_end] [blank_start]firstname[blank_end] [blank_start]varchar(25)[blank_end]
Respuesta
-
ALTER
-
TABLE
-
ALTER
-
COLUMN
-
tblStaff
-
firstname
-
varchar(25)
Pregunta 53
Pregunta
What is the SQL Statement to delete the table named tblStaff from Acme database?
[blank_start]DROP TABLE tblStaff[blank_end]