Ch. 1 Flashcards

1
Q

Which of the following Oracle tools can be used to execute SQL statements against a database?
- SQL Developer
- SQL*Plus command line
- SQL Language Reference Manual
- SQL Live

A
  • SQL Developer
  • SQL*Plus command line
  • SQL Live
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

The relational model consists of which of the following. Choose all that are true:

  • Primary and foreign keys
  • Collection of tables
  • Data integrity for accuracy and consistency
  • Set of operators to act on the relations, called the relational algebra
A

All are true

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

What are a primary key’s identifying characteristics? (select all that apply)
- it uniquely identifies each row
- it consists of only one column
- it cannot be null
- it must be numeric

A
  • it uniquely identifies each row
  • it cannot be null
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Which of the following is not required to form a syntactically correct SELECT statement?
- SELECT
- a valid table name
- FROM
- a valid column name

A
  • a valid column name
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Which of the following are not part of SQL? select all that apply

  • if..then..else selection
  • COMMIT
  • ROLLBACK
  • DO..WHILE loop
  • FOR..NEXT loop
A
  • if..then..else selection
  • DO..WHILE loop
  • FOR..NEXT loop
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Which component(s) of the following query is/are a literal (select all that apply):
SELECT order_id || ‘-‘ || line_item_id || ‘ ‘ || quantity “Purchase”
FROM line_item;
- “Purchase”
- ‘ ‘
-‘-‘
- ||

A
  • ’ ‘
  • ’-‘
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

The SHIPS table has two columns: SHIP_ID and SHIP_NAME
Which of the following SELECT statements will produce a syntax error? (Choose two.)

  • SELECT ship_id, ship_id FROM SHIPS;
  • SELECT FROM ships;
  • SELECT (ship_id, ship_name) FROM ships;
  • SELECT 1 + 2 FROM ships;
A
  • SELECT FROM ships;
  • SELECT (ship_id, ship_name) FROM ships;
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Which of the following are valid datatypes in Oracle SQL? select all that apply

  • VARCHAR2
  • CHAR
  • VARCHAR2(50)
  • CHAR(12)
A
  • CHAR
  • VARCHAR2(50)
  • CHAR(12)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Which of the following are string literals? select all that apply
- ‘Hogwarts School of Witchcraft and Wizardry’
- ‘975 *==+’
- NULL
- Harry Potter

A
  • ‘Hogwarts School of Witchcraft and Wizardry’
  • ‘975 *==+’
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

SQL is case sensitive, so you must capitalize all keywords, such as SELECT and FROM.
- True
- False

A

False

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

What is the dummy table called in Oracle

A

DUAL

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

A table consists of ..

  • Rows and columns, primary key, and possibly foreign keys
  • Names and statements
  • many-to-many relationship
  • relationships such as one-to-many
A
  • Rows and columns, primary key, and possibly foreign keys
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

For the datatype NUMBER(5,2) which of the following numbers would NOT work?

  • 3344.56
  • 176
  • 95.78
  • 8.7
A
  • 3344.56
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Which of the folllowing would you use to concatenate two strings together?
- &
- |
- ||
- +

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

What keyword is used to eliminate duplicate rows in query’s output?
- UNIQUE
- DISTINCT
- DIFFERENT
- DUPLICATE

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

Explain the difference between a Database and SQL

A
  • Database is a persistent store of data
  • SQL is the industry standard language for creating and interacting with a relational database
17
Q

Which is used to build data objects and define structures of the database?

A

Data Definiton Language (DDL)

18
Q

Consider the following rows in a table called CUSTOMERS:

CUST_ID FIRST_NAME MIDDLE LAST_NAME
1 Bianca M. Canales
2 Chua A. Nguyen
3 Bianca M. Jackson
4 Maya R. Canales
5 Bianca S. Canales

How many rows of data will be displayed as the result of executing the following statement: (one answer)

SELECT DISTINCT LAST_NAME, FIRST_NAME FROM CUSTOMERS;

A

4

19
Q

You are tasked with creating a SELECT statement to retrieve data from a database table named PORTS. The PORTS table has two columns: PORT_ID, and PORT_NAME. Which of the following is a valid SELECT statement? (Choose all that apply.)

  • SELECT PORT_ID FROM PORTS:
  • SELECT * FROM PORTS;
  • SELECT PORT_NAME, PORT_ID FROM PORTS;
  • SELECT ‘Name of the port ‘ || PORT_NAME FROM PORTS;
A
  • SELECT * FROM PORTS;
  • SELECT PORT_NAME, PORT_ID FROM PORTS;
  • SELECT ‘Name of the port ‘ || PORT_NAME FROM PORTS;