IT6 MOCK Flashcards

PASS

1
Q

You are writing a SELECT statement to find every product whose name contains a specific character.

Which keyword should you use in your WHERE clause?

A

LIKE

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

You need to populate a table named EmployeeCopy with data from an existing table named Employee.

Which statement should you use?

A

INSERT INTO EmployeeCopy
SELECT *
FROM Employee

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Another developer is trying to add a column named Prefix in a table by using the following query:

ALTER TABLE Person ADD Prefix varchar(4) NOT NULL;

The developer receives an error message after running the query. The developer is unable to remember the exact error message. What is likely the cause of this problem.

A

You should run the DROP CONSTRAINT query before running the ALTER TABLE query

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

You need to normalize a database to first normal form. Which two requirements must you meet?

A

*Exclude repeating groups & *Exclude duplicate rows

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Which statement creates an index?

A

CREATE TABLE Employee
(EmployeeID INTEGER PRIMARY KEY)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

You have a Customer table that stores information about customers and Order table that stores information about orders placed. Each table contain CustomerID column. You join the two tables by using the CustomerID column in each table.

You run a query that selects the following data:
-All customers and their orders
-Customers who have no orders

Which type of join do these results represent?

A

Full Join

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Which SQL statement is a data manipulation language (DML) statement?

A

SELECT EmployeeName FROM Employee
WHERE EmployeeName = ‘Jack Smith’;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

You have a table named Product. You create a view that includes all the products from the Product table that are in the Furniture category. You execute a statement on the Product table that deletes all the products in the Furniture category. After you execute the statement, the result set of the view is:

A

Empty

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

You execute the following query:

SELECT EmployeeID, FirstName, DepartmentName

FROM Employee, Department

This type of operation is called a/an:

A

Cartesian Product

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Which SQL statement will return the country and number of orders in each country where the number of orders is less than 50?

orderID represents an individual order, Country represents the country, and Orders represent the number of orders.

A

SELECT COUNT (OrderID) , Country
FROM Orders
GROUP BY Country
HAVING COUNT (orderID) < 50

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Which keyword combines the results of two queries and return only rows that appear in both result sets?

A

INTERSECT

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Structuring a table in relational database. In each statement select TRUE or FALSE. Each item will receive partial credit for each correct selection.

A

Each value in a field in a table must be unique (FALSE)
Each row in a table must be unique (TRUE)
Each column name in a table must be unique (TRUE)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

You have a table named Product. The Product table has columns for ProductDescription and ProductCategory. You need to change the ProductCategory value for all the spoons in the Product table to 43. A ProductDescription of spoon indicates that the items is a spoon.
Which statement should you use?

A

UPDATE Product
SET ProductCategory = 43
WHERE ProductDescription = ‘spoon’

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

You are creating a database object named Student to store the following data. Which syntax should you use to create the object?

A

CREATE TABLE Student (
ID INT,
Name VARCHAR(100),
Age INT)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

The Products table contains the following data:
Which query will retrieve ItemName and Price when chocolate appears in the ItemDescription column?

A

SELECT ItemName, Price
FROM Products
WHERE ItemDescription LIKE ‘%chocolate%’;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

You need to disable User1’s access to view the data in the Customer table. Which statement should you use?

A

REVOKE SELECT ON Customer
FROM User1

17
Q

You have a Department table and an Employee table in your database. You need to ensure that an employee can be assigned to only an existing department. What should you apply to the Employee table?

A

A foreign key

18
Q

You accept an IT internship at a local charity. The charity asks you to keep a record of its volunteers by using a database table named Volunteer. The table has the following columns and rows. You must update the table when volunteers ask to be removed from mailing lists. You need to delete all records with the GivenName Tin. Which SQL statement should you use?

A

DELETE FROM Volunteer WHERE GivenName = ‘Tia’

19
Q

Which statement creates a composite key?

A

CREATE TABLE Order
(OrderID INTEGER,
OrderItemID INTEGER,
PRIMARY KEY (OrderID, OrderItemID) )

20
Q

Which statement should you use to remove a foreign key?

A

ALTER TABLE

21
Q

Which query will increase the price of item 1 by 6 percent?

A

UPDATE Products
SET Price = Price * 1.06
WHERE ItemNumber = 1;

22
Q

You have a table named Product that contains one million rows. You need to search for product information using the following query:

SELECT ProductName, Price FROM Product WHERE Category = ‘Science Books’
What will make this type of search more efficient?

A

A non-clustered index on the Category column

23
Q

You have a table named Employee that includes the following columns:

EmployeeID
EmployeeName

Which statement should you use to return the number of rows in the table?

A

SELECT COUNT (*)
FROM Employee

24
Q

One reason to create a stored procedure is to:

A

Improve performance

25
Q

You execute the following statement.
INSERT INTO Road VALUES (1234, 36)
What is the result?

A

A new row in the table

26
Q

You need to remove a view named EmployeeView from your database. Which statement should you use?

A

DROP VIEW EmployeeView

27
Q

Select TRUE If the statements is true, Otherwise, select FALSE.

A

A full database backup is a copy of all the data in the entire database (TRUE)

A transaction log backup backs all the data in the database (FALSE)

A differential backup copies only data that was changed before the last full backup (FALSE)

A file or filegroup restore specified a portion of the database to recover (TRUE)

28
Q
A