IT6 MOCK Flashcards
PASS
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?
LIKE
You need to populate a table named EmployeeCopy with data from an existing table named Employee.
Which statement should you use?
INSERT INTO EmployeeCopy
SELECT *
FROM Employee
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.
You should run the DROP CONSTRAINT query before running the ALTER TABLE query
You need to normalize a database to first normal form. Which two requirements must you meet?
*Exclude repeating groups & *Exclude duplicate rows
Which statement creates an index?
CREATE TABLE Employee
(EmployeeID INTEGER PRIMARY KEY)
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?
Full Join
Which SQL statement is a data manipulation language (DML) statement?
SELECT EmployeeName FROM Employee
WHERE EmployeeName = ‘Jack Smith’;
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:
Empty
You execute the following query:
SELECT EmployeeID, FirstName, DepartmentName
FROM Employee, Department
This type of operation is called a/an:
Cartesian Product
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.
SELECT COUNT (OrderID) , Country
FROM Orders
GROUP BY Country
HAVING COUNT (orderID) < 50
Which keyword combines the results of two queries and return only rows that appear in both result sets?
INTERSECT
Structuring a table in relational database. In each statement select TRUE or FALSE. Each item will receive partial credit for each correct selection.
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)
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?
UPDATE Product
SET ProductCategory = 43
WHERE ProductDescription = ‘spoon’
You are creating a database object named Student to store the following data. Which syntax should you use to create the object?
CREATE TABLE Student (
ID INT,
Name VARCHAR(100),
Age INT)
The Products table contains the following data:
Which query will retrieve ItemName and Price when chocolate appears in the ItemDescription column?
SELECT ItemName, Price
FROM Products
WHERE ItemDescription LIKE ‘%chocolate%’;