Practice Midterm Flashcards

1
Q

True or False? The keyword BETWEEN can be used in a WHERE clause to refer to a range of values.

A

True

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

True or False? To establish a range of values, < and > can be used.

A

True

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

True or False? If you are going to use a combination of three or more AND and OR conditions, it is often easier to
use the NOT and NOT IN operators.

A

True

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

True or False? The keyword LIKE can be used in a WHERE clause to refer to a range of values.

A

False

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

True or False? The format SELECT-FROM-WHERE is the fundamental framework of SQL SELECT statements.

A

True

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

True or False? The SQL statement: SELECT Number1 + Number2 AS Total FROM NUMBER_TABLE; adds two
numbers from each row together and lists the results in a column named Total.

A

True

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

True or False? Data Manipulation Language (DML) commands are used to define a database, including creating,
altering, and dropping tables and establishing constraints.

A

False

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

True or False? The result of every SQL query is a table.

A

True

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

True or False? The wildcard asterisk (*) is the Oracle SQL standard for indicating “any sequence of characters”.

A

False

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

True or False? The SQL keyword GROUP BY instructs the DBMS to group together those rows that have the same
value in a column.

A

True

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

Which statement is wrong about PRIMARY KEY constraint in SQL?
The Primary key…
a) uniquely identifies each record in a SQL database table.
b) can be made based on multiple columns
c) must be made of any single columns.
d) must contain UNIQUE values.

A

c) Primary key must be made of any single columns.

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

In existing table, ALTER TABLE statement is used to:

A

a) Add columns.
b) Add constraints.
c) Delete columns.

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

What is the SQL Query to delete all rows in a table without deleting the table (structure, attributes, and indexes).

A

DELETE FROM table_name;

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

In a table, a column contains duplicate value, if you want to list all different value only, then which SQL
clause is used?

A

DISTINCT

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

To give a temporary name to a table, or a column in a table for more readability, what is used?

A

aliases

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

Logical operators used in SQL are

A

AND, OR , NOT

17
Q

To search for a specified pattern in a column, use

A

LIKE

18
Q

Wrong statement about ORDER BY keyword is:

a) Used to sort the result-set in ascending or descending order
b) The ORDER BY keyword sorts the records in ascending order by default
c) To sort the records in ascending order, use the ASC keyword
d) To sort the records in descending order, use the DECENDING keyword.

A

d) To sort the records in descending order, use the DECENDING keyword.

19
Q

Which SQL statement is used to extract data from a database?.

A

SELECT

20
Q

If you want to allow age of a person > 18 in the column Age of table Person, then which constraint will be
applied to AGE column.

A

Check

21
Q

What are the two rules of a relational database?

A

Entity and Referential Integrity

22
Q

What is Entity Integrity?

A
  1. Entity Integrity is when no column within a primary key is null. This is necessary since the primary key is necessary to uniquely identify a row or an entity.
23
Q

What is Referential Integrity?

A
  1. Referential Integrity is whenever a foreign key value is used it must refer to a existing and valid primary key within the primary table. A lack of this type of integrity will return us with incomplete or missing data.
24
Q

Describe different types of relationships with examples.

A
  1. A PERSON is linked to an ID NUMBER, and a ID NUMBER has is linked to a PERSON. (One to One)
  2. A MUSEUM contains many ART WORKS, but ART WORKS are in only one MUSEUM at a time. (One to Many)
  3. Many TEXTBOOKS contains many AUTHORS and AUTHORS can be in more than one TEXTBOOK. (Many to Many)