Pytania i odpowiedzi Flashcards

1
Q

The terms “bitmap,” “b-tree,” and “hash” refer to which type of database structure?

A

Index

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

One reason to add an index is to:

A

Improve performance of select statements.

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

You have a table that contains the following data.

You break the table into the following two tables.

This process is referred to as:

A

Normalization

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

You have a table that contains the following data.

Which database term is used to describe the relationship between ProductID and ProductCategory?

A

Functionally dependent

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

Which key uniquely identifies a row in a table?

A

primary

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

At 3:00 P.M. (1500 hours), you create a backup of your database. At 4:00 P.M. (1600 hours), you create a table named Customer and import data into the table.
At 5:00 P.M. (1700 hours), your server fails.
You run a script to apply only the 3:00 P.M. backup to your database. What is the result of the script?

A

The Customer table no longer exists.

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

In which situation do you need to perform a restore on a database?

A

when data becomes corrupted in the database

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

Which command should you use to give a user permission to read the data in a table?

A

GRANT SELECT

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

You need to enable a new employee to authenticate to your database.
Which command should you use?

A

CREATE USER

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

Which keyword can be used in a create table statement?

A

UNIQUE

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

You need to store product quantities, and you want to minimize the amount of storage space that is used. Which data type should you use?

A

INTEGER

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

You need to store product names that vary from three to 30 characters. You also need to minimize the amount of storage space that is used.
Which data type should you use?

A

VARCHAR (30)

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

One reason to create a stored procedure is to:

A

Improve performance.

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

Which permission does a user need in order to run a stored procedure?

A

EXECUTE

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
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
16
Q

In SQL, an insert statement is used to add a:

A

Row of data to a table.

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

You have two tables. Each table has three rows.

How many rows will be included in the Cartesian product of these two tables?

A

9

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

You are writing an SQL statement to retrieve rows from a table.
Which data manipulation language (DML) command should you use?

A

SELECT

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

Which constraint ensures a unique value in the ID column for each customer?

A

PRIMARY KEY

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

The component that holds information for a single entry in a table is called a:

A

Row

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

You execute the following statement:
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
22
Q

Which command should you use to add a column to an existing table?

A

ALTER

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

You have the following table definition:

CREATE TABLE Product -
(ID INTEGER PRIMARY KEY,
Name VARCHAR(20),
Quantity INTEGER)
The Product table contains the following data.

You execute the following statement:
SELECT Name FROM Product WHERE Quantity IS NOT NULL
How many rows are returned?

A

3

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
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
25
Q

A database contains two tables named Customer and Order.
You execute the following statement:

DELETE FROM Order -

WHERE CustomerID = 209 -
What is the result?

A

All orders for CustomerID 209 are deleted from the Order table.

26
Q

You have a table that contains information about all students in your school.
Which SQL keyword should you use to change a student’s first name in the table?

A

UPDATE

27
Q

Which keyword would you use in a select statement to return rows that meet a specific condition?

A

WHERE

28
Q

The Product table contains the following data.

You execute the following statement:
SELECT COUNT(*)
FROM Product WHERE Quantity > 18
What is the value returned by this statement?

A

3

29
Q

You need to store the contact information for each student in your school database.
You should store each student’s information in a:

A

Row

30
Q

Which category of SQL statements is used to add, remove, and modify database structures?

A

Data definition language (DDL)

31
Q

You have a Customer table and an Order table. You join the Customer table with the Order table by using the CusromerID column.
The results include:

All customers and their orders -

✑ Customers who have no orders
Which type of join do these results represent?

A

Outer join

32
Q

Data in a database is stored in:

A

Tables

33
Q

You have a table named Student that contains 100 rows. Some of the rows have a NULL value in the FirstName column.
You execute the following statement:

DELETE FROM Student -
What is the result?

A

All rows in the table will be deleted.

34
Q

You need to establish a set of permissions that you can routinely assign to new users.
What should you create?

A

Role

35
Q

Which database term is used to describe the process of applying a backup to a damaged or corrupt database?

A

Restore

36
Q

Denormalization is performed in order to:

A

Improve query performance.

37
Q

You have a table named Product that contains one million rows.
You need to search for product information in the Product table by using the product’s unique ID.
What will make this type of search more efficient?

A

An index

38
Q

Which keyword must be included in a create view statement?

A

SELECT

39
Q

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

A

DROP VIEW EmployeeView

40
Q

A named group of SQL statements that can be executed in a database is called a:

A

Stored procedure

41
Q

A view can be used to:

A

Limit access to specific rows or columns of data in a table.

42
Q

On which database structure does an update statement operate?

A

Table

43
Q

You delete rows in a table named Order. The corresponding rows in the OrderItem table are automatically deleted. This process is an example of a/an:

A

Cascade delete

44
Q

You have a table named Employee that includes four columns.
You execute the following statement:
SELECT *

FROM Employee -
Which columns are returned?

A

all columns

45
Q

Which two elements are required to define a column? (Choose two.)

A

A name , A data type

46
Q

What defines the amount of storage space that is allocated to a value in a column?

A

data type

47
Q

You are creating a table to store customer data. The AccountNumber column uses values that always consist of one letter and four digits. Which data type should you use for the AccountNumber column?

A

CHAR

48
Q

What is one difference between an update statement and a delete statement?

A

An update statement does not remove rows from a table.

49
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

50
Q

You need to store the first name, last name, and student ID for 100 students.
This information will be stored in a table as:

A

100 rows and three columns.

51
Q

What are three valid data manipulation language (DML) commands? (Choose three.)

A

INSERT, DELETE , UPDATE

52
Q

You assign User1 a set of permissions that include the WITH GRANT OPTION.
The WITH GRANT OPTION enables User1 to:

A

create new database users.

53
Q

Which type of index changes the order in which the data is stored in a table?

A

non-sequential

54
Q

Which statement should you use to remove a foreign key?

A

ALTER TABLE

55
Q

First normal form requires that a database excludes:

A

Repeating groups

56
Q

You execute a statement inside a transaction to delete 100 rows from a table. The transaction fails after only 40 rows are deleted.
What is the result in the database?

A

No rows will be deleted from the table.

57
Q

You have a table that contains product IDs and product names.
You need to write an UPDATE statement to change the name of a specific product to glass.
What should you include in the update statement?

A

SET ProduetName = ‘glass’

58
Q

On which database structure does an insert statement operate?

A

Table

59
Q

You have a table of products with fields for ProductID, Name, and Price.
You need to write an UPDATE statement that sets the value in the InStock field to Yes for a specific ProductID.
Which clause should you use in your update statement?

A

WHERE

60
Q

You need to combine the results of two queries into a single result that contains all of the rows from both queries.
Which Structured Query Language (SQL) statement should you use?

A

UNION

61
Q

You accept an IT internship at a local charity. The charity wants you to help them with compliance and auditing requirements.
You need to ensure that a column or combination of columns uniquely identifies each row of a table.
Which constraint should you define?

A

Foreign key

62
Q

A view can be used to ensure referential integrity.

A

Limit access to specific rows or columns of data in a table.