Frage 1
Frage
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.
Frage 2
Frage
The MDF file type holds the raw data for the database.
Frage 3
Frage
The [blank_start]LDF[blank_end] file type is the log file that holds transactions.
Frage 4
Frage
It is best practice for the MDF and LDF files to be stored on separate disk volumes if possible.
Frage 5
Frage
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].
Frage 6
Frage
By default, the [blank_start]primary key[blank_end] is a clustered index.
Frage 7
Frage
Check off what is TRUE about a non clustered index within SQL Server:
Antworten
-
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.
Frage 8
Frage
Only one clustered index can exist on a single [blank_start]table[blank_end].
Frage 9
Frage
You can have as many non-clustered indexes in a table as you have [blank_start]columns[blank_end].
Frage 10
Frage
What type of SERVER-LEVEL roles will Microsoft SQL Server support? Check all that apply.
Antworten
-
sysadmin
-
serveradmin
-
securityadmin
-
dbcreator
-
public
-
db_owner
-
db_datareader
Frage 11
Frage
What type of DATABASE-LEVEL roles will Microsoft SQL Server support? Check all that apply.
Antworten
-
db_owner
-
db_securityadmin
-
db_datareader
-
db_backupoperator
-
db_datawriter
Frage 12
Frage
Indexes are sorted using a [blank_start]Balanced Tree[blank_end].
Frage 13
Frage
Label the three levels in the image:
Frage 14
Frage
Assume we want to add a user called James into the B-Tree. What would have to be done?
Antworten
-
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
Frage 15
Frage
When is the most ideal situation to use a B-Tree?
Antworten
-
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.
Frage 16
Frage
What is a "Commit"?
Antworten
-
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.
Frage 17
Frage
What is a "Checkpoint"?
Antworten
-
Writes committed transactions to the database.
-
A read-only buffer cache.
-
Modifies records within tables.
Frage 18
Frage
A Simple Recovery model does not permanently keep transaction logs.
Frage 19
Frage
A Full Recovery model keeps the transaction logs, meaning they can be used in a restore.
Frage 20
Frage
The drawbacks of a Full Recovery model are: (check all that apply).
Antworten
-
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.
Frage 21
Frage
Which SQL statement will you use to add a table called tblFuck within your database?
[blank_start]CREATE TABLE tblFuck[blank_end]
Frage 22
Frage
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]
Antworten
-
Domain
-
Referential
-
Entity
-
Domain
-
Referential
-
Entity
-
Referential
-
Domain
-
Entity
-
Entity
-
Domain
-
Referential
-
Entity
-
Domain
-
Referential
Frage 23
Frage
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]
Antworten
-
SELECT
-
from
-
WHERE
-
>= 100
-
AND
-
<= 200
Frage 24
Frage
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]
Antworten
-
ALTER
-
ADD
-
varchar(50)
-
TABLE
Frage 25
Frage
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
Frage 26
Frage
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
Antworten
-
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
Frage 27
Frage
A transaction started before and committed after a checkpoint.
Then a system failure occurred.
When the system comes back online, what would occur?
Frage 28
Frage
A transaction started and committed before a checkpoint.
Then a system failure occurred.
What is required?
Antworten
-
No action is required.
-
A roll back.
-
A roll forward.
-
The data is corrupt.
Frage 29
Frage
A transaction started before the checkpoint.
It never fully committed at the time of the crash.
What action is required?
Frage 30
Frage
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]
Frage 31
Frage
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
Antworten
-
SELECT
-
FROM
-
WHERE
-
'USA'
-
AND
-
'Detroit'
-
ORDER
-
BY
Frage 32
Frage
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
Antworten
-
SELECT
-
FROM
-
WHERE
-
'USA'
-
OR
-
'Canada'
Frage 33
Frage
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]
Antworten
-
SELECT
-
tblStaff.Name
-
tblDept.Name
-
FROM
-
tblStaff
-
JOIN
-
tblDept
-
ON
-
tblDept.ID_Dept
-
tblStaff.ID_Dept
-
=
Frage 34
Frage
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]
Antworten
-
SELECT
-
avg
-
unitprice
-
FROM
-
tblOrders
Frage 35
Frage
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]
Antworten
-
SELECT
-
COUNT
-
*
-
FROM
-
WHERE
-
'London'
-
City
-
=
-
tblLocations
Frage 36
Frage
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]
Antworten
-
SELECT
-
Cost
-
*
-
Quantity
-
*
-
1.13
-
'Total'
-
FROM
-
tblOrders
Frage 37
Frage
Will this query run successfully?
SELECT FirstName, LastName
FROM tblEmployees
GROUP BY FirstName
Antworten
-
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.
Frage 38
Frage
Will this query run successfully?
SELECT ProductName, SUM(UnitPrice), SUM(Cost), UnitPrice * Cost
FROM Orders
GROUP BY ProductName
Antworten
-
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.
Frage 39
Frage
What is true about views? Select all that apply.
Antworten
-
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.
Frage 40
Frage
[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]
Antworten
-
ALTER
-
VIEW
-
vEmployees
-
AS
-
Select
-
ID_EMP
-
FirstName
-
LastName
-
FROM
-
Employees
Frage 41
Frage
What is true about stored procedures? Check all that apply.
Antworten
-
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.
Frage 42
Frage
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]
Antworten
-
CREATE
-
PROCEDURE
-
USP_ViewEmp
-
AS
-
BEGIN
-
END
-
GO
Frage 43
Frage
Which of the following help ensure data integrity?
Select all that apply.
Frage 44
Frage
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])
Antworten
-
ALTER
-
TABLE
-
ADD
-
CONSTRAINT
-
CK_Salary
-
CHECK
-
Salary
-
<=
-
100000
Frage 45
Frage
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]
Antworten
-
ALTER
-
TABLE
-
Employees
-
NOCHECK
-
CONSTRAINT
-
CK_Salary
Frage 46
Frage
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.
Frage 47
Frage
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]
Frage 48
Frage
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]
)
Antworten
-
CREATE
-
TABLE
-
ID_Staff
-
INT
-
PRIMARY
-
KEY
-
FirstName
-
varchar(50)
-
NOT NULL
-
LastName
-
varchar(50)
-
NOT NULL
-
varchar(4)
-
Extension
Frage 49
Frage
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]
Frage 50
Frage
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]
Antworten
-
ALTER
-
TABLE
-
ADD
-
Departments
-
varchar(50)
Frage 51
Frage
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]
Antworten
-
ALTER
-
TABLE
-
DROP
-
COLUMN
-
Departments
Frage 52
Frage
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]
Antworten
-
ALTER
-
TABLE
-
ALTER
-
COLUMN
-
tblStaff
-
firstname
-
varchar(25)
Frage 53
Frage
What is the SQL Statement to delete the table named tblStaff from Acme database?
[blank_start]DROP TABLE tblStaff[blank_end]