CTS 2477

0.0(0)
studied byStudied by 0 people
0.0(0)
full-widthCall with Kai
GameKnowt Play
New
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/123

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

124 Terms

1
New cards

Refer to the Product table. How many rows appear in the query's result table?

SELECT DISTINCT Size FROM Product;

4 rows

2
New cards

Refer to the Product table. Complete the SQL statement to select all products with sizes 0-3M, 3-6M, and 6-9M.

SELECT ProductName, Quantity

FROM Product

WHERE Size _____ ('0-3M', '3-6M', '6-9M');

IN

3
New cards

Refer to the Product table. Complete the SQL statement to select all products sold as a set.

SELECT ProductName, Quantity

FROM Product

WHERE ProductName LIKE _____;

'%set'

4
New cards

Refer to the tables. Complete the ORDER BY clause to produce the result table below.

SELECT *

FROM Product

ORDER BY _____;

UnitPrice DESC

5
New cards

Complete the ORDER BY clause to sort the Products by ProductName alphabetically, then in decreasing Quantity.

SELECT ProductName, Size, Quantity, SupplierId

FROM Product

ORDER BY _____ ;

ProductName, Quantity DESC

6
New cards

What does the following statement return?

SELECT ROUND(12.439, 1);

12.4

7
New cards

What does the following statement return?

SELECT SUBSTRING('Excellent', 3, 4);

'cell'

8
New cards

What does the following statement return?

​​SELECT DATEDIFF('2020-11-04', '2020-11-09');

-5

9
New cards

Refer to the Product table. Complete the SQL statement so the result table shows 63, which is the total quantity of all products.

SELECT _____ FROM Product;

SUM(Quantity)

10
New cards

Refer to the Product table. Complete the SQL statement so the result table shows 23.99.

SELECT _____ FROM Product;

MAX(UnitPrice)

11
New cards

Refer to the Customer table. Which query returns the result table below?

SELECT RewardsMember, COUNT(*)

FROM Customer

GROUP BY RewardsMember;

12
New cards

Refer to the Customer table. Which query returns the result table below?

SELECT State, COUNT(*)

FROM Customer

GROUP BY State

HAVING COUNT(*) > 1;

13
New cards

Evaluate the SQL statement and data below. What is correct result?

SELECT SUM(Cost) + SUM(Markup)

FROM Profit;

485

14
New cards

In the SQL query below, the Teacher table is the _____.

SELECT LastName, FirstName, CourseTitle

FROM Teacher

INNER JOIN Class ON Teacher.TeacherID = Class.TeacherID;

left table

15
New cards

Refer to the tables below. Which join completes the SQL query and produces the result table below?

SELECT CourseTitle, FirstName, LastName FROM Class _____ Teacher ON Class.TeacherID = Teacher.TeacherID;

LEFT JOIN

16
New cards

Refer to the tables below. Which join completes the SQL query and produces the result table below?

SELECT CourseTitle, FirstName, LastName FROM Class _____ Teacher ON Class.TeacherID = Teacher.TeacherID;

RIGHT JOIN

17
New cards

What is wrong in the following query?

SELECT Sales.OrderID, Customer.FirstName, Customer.LastName

FROM Sales

INNER JOIN Customer ON CustomerID = CustomerID;

The CustomerID prefix is missing.

18
New cards

The query below is a/an _____?

SELECT LastName, FirstName, CourseTitle FROM Teacher INNER JOIN Class ON Teacher.TeacherID = Class.TeacherID;

equijoin

19
New cards

A database administrator wants to correlate pairs of rows from the same table. Which type of join should the database administrator use?

self-join

20
New cards

The following tables describe parts and companies that supply parts:

CREATE TABLE Part ( PartID SMALLINT, PartName VARCHAR(30), PartSuppierCode CHAR(3), PRIMARY KEY (PartID), FOREIGN KEY (PartSupplierCode) REFERENCES Supplier (SupplierCode) );

CREATE TABLE Supplier ( SupplierCode CHAR(3), SupplierName VARCHAR(30), PostalCode CHAR(5), PRIMARY KEY (SupplierCode) );

The following query selects all possible combinations of part names and supplier names. What XXX completes the query?

SELECT PartName, SupplierName FROM Part XXX;

CROSS JOIN Supplier

21
New cards

The following table lists parts. Many parts are contained in another part, called an assembly, and tracked in the AssemblyID column. If a part is not contained in another part, the AssemblyID is NULL.

CREATE TABLE Part ( PartID SMALLINT, PartName VARCHAR(30), AssemblyID SMALLINT, PRIMARY KEY (PartID), FOREIGN KEY (AssemblyID) REFERENCES Part(PartID) );

The following self-join selects one row for each part. Each row contains the names of the part and the assembly, if any, containing the part. What XXX completes the query?

SELECT P.PartName AS Part, A.PartName AS Assembly FROM Part P XXX;

LEFT JOIN Part A ON P.AssemblyID = A.PartID

22
New cards

Refer to the tables. Which products are selected by the query below?

SELECT ProductName FROM Product WHERE SupplierID IN (SELECT SupplierID FROM Supplier WHERE CountryID = 2);

Onesies set, Sunsuit, Romper

23
New cards

Refer to the Product table. Which products are selected by the query below?

SELECT ProductName FROM Product WHERE Quantity > (SELECT MIN(Quantity) FROM Product);

Onesies set, Sunsuit, Pajama set, Shorts set

24
New cards

A/An _______ is a subquery that contains a reference to a table column that also appears in the outer query.

correlated subquery

25
New cards

Refer to the tables. The Product's Quantity column stores the stockroom's product quantity before any products are sold. Which products are selected by the query below?

SELECT ProductName FROM Product P WHERE Quantity > (SELECT SUM(Quantity) FROM Sales WHERE ProductID = P.ProductID);

all products that are in stock

26
New cards

Refer to the tables. Which products are returned by the query below?

SELECT ProductName FROM Product P WHERE NOT EXISTS (SELECT * FROM Sales WHERE ProductID = P.ProductID);

Romper, Pajama set

27
New cards

Refer to the tables and the nested query below. Which flattened query generates the same result as the nested query?

SELECT E.Name FROM Employee E WHERE EXISTS (SELECT * FROM Family F WHERE F.ID = E.ID AND Relationship = 'Daughter');

SELECT DISTINCT E.Name

FROM Employee E

INNER JOIN Family F ON F.ID = E.ID

WHERE Relationship = 'Daughter';

28
New cards

Refer to the tables. Which query produces the result table below?

SELECT S.OrderId, P.ProductName, P.UnitPrice * S.Quantity AS SubTotal FROM Sales S INNER JOIN Product P ON S.ProductId = P.ProductId;

29
New cards

Refer to the tables. Which query produces the result table below?

SELECT S.OrderId, C.CustomerName FROM Sales S INNER JOIN Customer C ON S.CustomerId = C.CustomerId;

30
New cards

Refer to the tables. What should be added to the SELECT caluse to produce the result table below?

SELECT _____ AS TotalSales FROM Sales S INNER JOIN Product P ON S.ProductId = P.ProductId;

SUM(P.UnitPrice * S.Quantity)

31
New cards

A view table provides which benefit when created in a database with multiple tables?

A consolidated view of specific data without changing the underlying database structure

32
New cards

When a database stores view data, it uses ______ that depends on data in a corresponding ______.

materialized view

base table

33
New cards

which statement is an advantage of using a view table?

FALSE: The creation of a new base table is always up to date.

Complex SELECT statements can be saved in a view table.

Sensitive table data can be hidden from users and programmers.

Optimal SELECT statements can be saved in a view table.

34
New cards

what causes the generation of a NULL primary key value when using a view in an INSERT statement?

the base table primary key is not included in the view table

35
New cards

An Inventory view table is defined with a WHERE clause that specifies ShelfNumber = 25. An INSERT adds a new item to ShelfNumber 20. What happens when the WITH CHECK OPTION is not specified in the CREATE VIEW statement?

the item appears in the base table but not in the view table (gets rejected)

36
New cards

which relational algebra operation is denoted by the green letter ρ?

rename

37
New cards

which relational expression is equivalent to the following SQL statement?

Π(PassengerName)(σ(TicketPrice<1000)(Booking))

38
New cards

What type of join is executed by the following relational algebra expression?

Department⋈Department.Manager=Employee.IDEmployee

Inner

39
New cards

in the relational algebra, compatible tables have the same _____.

number of columns and data types

40
New cards

Refer to the following tables:

How many rows are in the table defined by the following relational algebra expression?

Employee∩Student

0

41
New cards

Refer to the Employee table:

How many rows are in the table defined by the following relational algebra expression?

σ(Salary > 50000)(ρ(Department,Salary)(DepartmentγSUM(Salary)(Employee)))

2

42
New cards

When data is produced and stored as numeric, textual, or visual information, it varies in _____.

Format

43
New cards

What does a user that interacts with a database use to read and write data?

Query Language

44
New cards

Which role focuses on creating software that interacts with a database?

Programmer

45
New cards

Which database role focuses on database storage, response times, and optimization?

Designer

46
New cards

Which concept relates to software that reads and writes data in a database?

Management System

47
New cards

A database management system reads and writes data in a database, and ________.

ensures consistency and availability

48
New cards

What design consideration would apply to a database that has special performance requirements?

Structuring data properly on storage media

49
New cards

If a database system is processing three queries as part of a transaction and the third query fails, what happens to the transaction?

The successful query results are reverse and the transaction is canceled

50
New cards

How does a database system protect data when concurrent transactions occur?

preventing multiple transactions with the same data at the same time

51
New cards

In terms of database architecture, which component translates the query processor instructions into low-level file-system commands and is responsible for indexing the data?

Storage manager

52
New cards

Which type of database system is optimized for big data?

NoSQL

53
New cards

When a user interacts with a database, they can use a _____ to modify data with commands.

Query Language

54
New cards

The _______ SQL statement does not alter any database data.

SELECT

55
New cards

When using a SQL statement to create a table, which data type is used to store a fractional value?

DECIMAL

56
New cards

A database administrator uses which two SQL statements to view and modify existing customer balance with a late fee?

SELECT, UPDATE

57
New cards

A user creates a table by using a SQL statement. The data type VARCHAR(11) is part of the statement. What does the value of (11) represent?

The number of characters allowed for the data type

58
New cards

The analysis phase of database design includes which process?

Specifying requirements that are not dependent on a specific database system.

59
New cards

A database ______ is the implementation of database requirements in SQL with CREATE TABLE statements.

schema

60
New cards

Which principle defines data independence?

Physical design never affects query results.

61
New cards

What links a host programming language to a database system?

API

62
New cards

In the following ER diagram, what does 'AlbumTitle' represent?

Attribute

63
New cards

A database designer installs MySQL Communicty Edition to create a database. Which account does the designer use to gain full control of MySQL?

Root

64
New cards

When using the MySQL Workbench GUI, which icon will execute an SQL statement?

Lightning Bolt

65
New cards

When using the MySQL Command-Line Client, which character ends a command line?

;

66
New cards

Which option is found on the Schemas tab in the MySQL Workbench?

A list of available datbaases

67
New cards

A database administrator creates a MySQL statement with incorrect syntax. What does MySQL Workbench display when the statement is executed?

Error Code

68
New cards

In the relational model, an unnamed tuple of values is a ______.

row

69
New cards

What is the result of a relational operation?

Table

70
New cards

In a relational model, a column is _______.

A name and a data type

71
New cards

A ______ is a collection of values with no inherent order.

set

72
New cards

_____ is not a relational algebra operation

Merge

73
New cards

What does SQL stand for?

Structured Query Language

74
New cards

UPDATE, SELECT, and ORDER BY are ____ in an SQL Statement

keyword

75
New cards

In the SQL below, which of the following is an identifier?

UPDATE Product

SET UnitPrice = 9.50

WHERE ProductId = 20;

Product

76
New cards

What language defines statements used for creating and dropping tables?

Data definition language

77
New cards

The statement below is an example from which SQL sublanguage?

SELECT ProductName

FROM Product;

Data Query Language

78
New cards

What is the correct statement for creating a database called reservationDB?

CREATE DATABASE reservationDB;

79
New cards

A database system has a database called onlineShop. What is the result of a CREATE statement that tries to create onlineShop a second time.

The statement produces an error that indicates the database already exists.

80
New cards

What is the correct statement for deleting a database?

DROP DATABASE DatabaseName;

81
New cards

What should be added to the SQL statements to produce the Result table below?

USE ______;

SHOW _________;

Result:

Tables_in_onlineShop

blah

blah

blah

blah

onlineShop

TABLES

82
New cards

In a table, columns are _____ and rows are ______.

ordered

not ordered

83
New cards

Data independence means

rows of a table have no inherent order

84
New cards

How many columns are created by the SQL statement below?

CREATE TABLE Supplier (

SupplierId INT,

CompanyName VARCHAR(40),

ContactName VARCHAR(50),

City VARCHAR(40),

Country VARCHAR(40),

Phone VARCHAR(30)

);

6

85
New cards

Which SQL statement deletes the table supplier?

DROP TABLE Supplier;

86
New cards

Which SQL statement adds a new column Fax to the Supplier table?

ALTER TABLE Supplier

ADD Fax VARCHAR(30);

87
New cards

Which SQL Statement deletes the City column from the Supplier table?

ALTER TABLE Supplier

DROP City;

88
New cards

What data type stores binary values?

BLOB

89
New cards

Which data type should a database use to store negative numbers?

INT

90
New cards

Choose the best data types to replace XXX and YYY.

CREATE TABLE Product (

ProductId INT,

ProductName XXX,

UnitPrice YYY

);

VARCHAR(50)

DECIMAL(8,2)

91
New cards

A value that is used in a computation is known as a/an ______.

operand

92
New cards

What is the correct order of operator precedence in SQL (high to low)?

* + = NOT AND OR

93
New cards

Which statement selects all rows and just the ProductName and Size columns from the Product table?

SELECT ProductName, Size

FROM Product;

94
New cards

Refer to the product table. Which columns are preset in the query's result table?

SELECT * FROM Product;

all columns are present

95
New cards

Refer to the product table. Which columns are preset in the query's result table?

SELECT ProductName FROM Product WHERE Quantity >= 10;

onesies set, sunsuit, pj set

96
New cards

Refer to the Product table. Which products are selected by the query below?

SELECT * FROM Product WHERE Quantity > 5 AND UnitPrice <= 15.00;

onsies set, pj set, shorts set

97
New cards

In mySQL what is the result of TRUE AND NULL?

NULL

98
New cards

what should be added so null values are not allowed in productname?

CREATE TABLE Product ( ProductId INT, ProductName _____, UnitPrice DECIMAL(5,2), SupplierId INT );

VARCHAR(50) NOT NULL

99
New cards

In mySQL, what is the result of TRUE OR NULL

TRUE

100
New cards

a null value represents ____.

missing data