CTS2433 Exam 1

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/44

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.

45 Terms

1
New cards

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

Structuring data properly on storage media.

2
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.

3
New cards

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

Management system

4
New cards

What links a host programming language to a database system?

API

5
New cards

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

ensures consistency and availability

6
New cards

The analysis phase of database design includes which process?

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

7
New cards

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

Error code

8
New cards

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

;

9
New cards

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

Programmer

10
New cards

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

SELECT, UPDATE

11
New cards

Which type of database system is optimized for big data?

NoSQL

12
New cards

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

query language

13
New cards

Which principle defines data independence?

Physical design never affects query results.

14
New cards

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

Root

15
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 reversed, and the transaction is canceled.

16
New cards

A column, or group of columns, that serves as the unique identifier in a relational database table is called a/an _____.

primary key

17
New cards

A _____ constraint specifies a column value that is used when no value is provided in an INSERT statement.

DEFAULT

18
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)

19
New cards

Which statement creates a primary key constraint on the ID column of the Employee table?

ALTER TABLE Employee ADD PRIMARY KEY (ID);

20
New cards

What foreign key action should be added to ensure that if a supplier is removed from the Supplier table, the products associated with the same supplier are also removed?

CREATE TABLE Product ( ProductId INT NOT NULL AUTO_INCREMENT, ProductName VARCHAR(50), UnitPrice DECIMAL(5,2), SupplierId INT, PRIMARY KEY (ProductId), FOREIGN KEY (SupplierId) REFERENCES Supplier(SupplierId) _____ );

ON DELETE CASCADE

21
New cards

In the following statement, the UNIQUE clause is a _____ constraint.

CREATE TABLE Employee ( ID SMALLINT UNSIGNED, FullName VARCHAR(60), Extension CHAR(4), UNIQUE (ID, Extension), PRIMARY KEY (ID) );

table

22
New cards

Refer to the Teacher and Class tables. The action ON UPDATE SET NULL is specified for the TeacherID foreign key. What is the result when Bryan McNeal's TeacherID is changed to 45672?

The TeacherID for Web Development is set to NULL.

23
New cards

Which language defines statements used for creating and dropping tables?

Data Definition Language

24
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

25
New cards

What is the result of a relational operation?

table

26
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.

27
New cards

In MySQL, what is the result of TRUE AND NULL?

NULL

28
New cards

Which of the following is not true about the INSERT statement?

A single INSERT statement can only add one row.

29
New cards

ShipPartCode is a foreign key in the Shipment table. ShipPartCode refers to the primary key PartCode of the Part table. What replaces XXX in the following statement?

CREATE TABLE Shipment ( ShipNumber INT UNSIGNED, ShipPartCode CHAR(3) NOT NULL, Quantity SMALLINT UNSIGNED, PRIMARY KEY (ShipNumber), XXX );

FOREIGN KEY (ShipPartCode) REFERENCES Part (PartCode)

30
New cards

The statement below is an example from which SQL sublanguage?

SELECT ProductName FROM Product;

Data Query Language

31
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

32
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

33
New cards

What does the following statement return?

SELECT ROUND(12.439, 1);

12

34
New cards

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

materialized view, base table

35
New cards

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

number of columns and data types

36
New cards

Which statement is NOT an advantage of using a view table?

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

37
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);

(It's asking to find what isn't currently in the Sales table PRODUCTID.)

Romper, Pajama set

38
New cards

What does the following statement return?

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

-5

39
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

40
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

41
New cards

What does the following statement return?

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

cell

42
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

43
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;

44
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

45
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)