ITS DATABASE STUDY Flashcards
What is likely the cause of the error when adding a NOT NULL column without a default value?
C. The DEFAULT keyword should be used to specify a default value
Which query meets the report requirements for students?
D. SELECT * FROM students WHERE enrollment_date >= ‘2020-06-01’ OR academic_status = ‘Graduated’ OR graduation_date >= ‘2020-01-01’ ORDER BY enrollment_date DESC
How many rows are returned by the SQL query on the Cars table?
a. 4
Which statement deletes a Customer record with ID 12345?
D. DELETE FROM Customer WHERE CustomerID = 12345
Which SQL statement is a DML operation?
C. INSERT INTO Employee VALUES (‘Jack Smith’)
Which query retrieves items with ‘chocolate’ in the description?
D. SELECT ItemName, Price FROM Products WHERE ItemDescription LIKE ‘%chocolate%’
Which statement creates a composite key?
A. CREATE TABLE Order (OrderID INTEGER, OrderItemID INTEGER, PRIMARY KEY (OrderID, OrderItemID))
Structuring a table: Field uniqueness, row uniqueness, column name uniqueness.
False (field uniqueness), True (row uniqueness), True (column name uniqueness)
Recommended data type for financial amounts?
a. Decimal
Which statement updates Harry’s books in San Francisco?
D. UPDATE LoanedBooks SET Books = 0 WHERE (NAME = ‘Harry’ AND City = ‘San Francisco’)
Which statement returns the number of rows in a table?
D. SELECT COUNT(*) FROM Employee
How to display total points per player on TeamID 1?
SELECT PlayerID, SUM(Points) FROM PlayerStat WHERE TeamID = 1 GROUP BY PlayerID
Which object ensures valid SalesPerson records in the Sales table?
B. Foreign key
How to create the NorthAmericanMammals view?
CREATE VIEW [dbo].[NorthAmericanMammals View] AS SELECT a.Id, a.Name FROM Animal a WHERE a.Class = ‘Mammals’ AND a.InNorthAmerica = 1
What happens to a view after deleting its underlying data?
d. Empty
Which keyword returns rows appearing in both result sets?
b. INTERSECT
A reason to create a stored procedure?
c. Improve performance
First normal form requirements?
a. Exclude duplicate rows; c. Exclude repeating groups
Which join includes all customers and those with no orders?
a. Full join
Query to select top 10 uninspected buildings?
SELECT TOP 10 FROM Building WHERE InspectionDate IS NULL ORDER BY InspectionDate
Assign data types to StudentName, GradeLevel, DaysAbsent?
StudentName VARCHAR; GradeLevel INT; DaysAbsent DECIMAL
Update ProductCategory for spoons?
A. UPDATE Product SET ProductCategory = 43 WHERE ProductDescription = ‘spoon’
Term for ProductID and ProductCategory relationship?
e. functionally dependent
Result of SELECT without JOIN?
d. Cartesian product