SQL QUIZ

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

What is SQL? A database for storing and maintaining state for data. A tool used solely for statistical analysis. A mentality for creating databases to be as least redundant as possible. A language for interacting with a database.

A language for interacting with a database.

A benefit of using JDBC is? It abstracts the process of opening a socket connection to a database manually, and handling each request/response. It provides features for managing transaction safety and performance It reduces the amount of work required to make changes to your configuration All of the above

All of the above

Mapping a many-to-many relationship in a database requires: Only one table. An intermediary junction table. A composite primary key. An array type column.

An intermediary junction table.

Which aggregate function is used to combine values into a number representing the number of total values? MAX SUM COUNT MIN

COUNT

Which SQL keyword is used for defining new tables or databases? DEFINE CREATE SELECT NEW

CREATE

Which SQL sublanguage is used to create and interact with rows in a table? DDL DML DCL TCL

DML

To make a join statement, you need to use which sublanguage? DDL DQL DCL TCL

DQL

Each database may contain only one table. False True

False

Scalar functions are used to search through a database and give a result based on conditions. False True

False

Transactions include all DML statements before and after COMMIT statements. False True

False

You can create a one to many relationship without a primary key to foreign key relationship False True

False

Which normalized form introduces the concept of enforcing primary keys and removing composite columns? First Second Third Fourth

First

What do we call a field that references a field in another table? Primary key Candidate Key Foreign Key Connection Key

Foreign Key

Which of the following SQL datatypes is best used to represent a whole number? DECIMAL INTEGER TIMESTAMP NUMBER

INTEGER

In the context of the JDBC; the method next() does what? It is used to obtain the next Connection object in the pool. It provides exception handling to the Connection object. It is used to iterate through a ResultSet. It will increment the value of a serial datatype in the database which is useful for generating Primary Keys.

It is used to iterate through a ResultSet.

In JDBC, a Statement is unsafe because It is vulnerable to SQL injection attacks Unlike Prepared Statements, data sent by a Statement query is unencrypted Statements are safe Statements may throw an exception which must be handled, while PreparedStatements will never throw exceptions

It is vulnerable to SQL injection attacks

Which of these is not a type of JDBC statement PreparedStatement Statement CallableStatement MacroStatement

MacroStatement

Which of the following SQL datatypes is best used to represent a decimal number? INTEGER SMALLINT TIMESTAMP NUMERIC

NUMERIC

Which is NOT a constraint in SQL? Unique Null Primary Key Foreign Key

Null

Which keyword is used to designate the column to make a join with? IN ON AT AND

ON

Which of the following is not a valid multiplicity relationship? One to one Many to many Many to one One to null

One to null

Which aggregate function is used to combine values into a number representing the combination of all of the values? MAX SUM COUNT MIN

SUM

What does SQL stand for? Standalone Query Language Standalone Query Lambdas Structured Query Language Structured Query Lambdas

Structured Query Language

Which SQL sublanguage is used to manage the state of a transaction? DDL DML DCL TCL

TCL

True or False: Every database needs its own driver, to translate JDBC commands into something that database can understand. TRUE FALSE

TRUE

Which normalized form introduces the concept of removing columns whose values are derived from other columns in the table? First Second Third Fourth

Third

A foreign key usually refers to a primary key or unique key of another table. False True

True

Different dialects of SQL have different, unique data types. True False

True

Scalar functions are used to perform an operation on values returned from a query. True False

True

Which of the following SQL datatypes is best used to represent one or more characters? NUMERIC VARCHAR IMAGE CHAR

VARCHAR

Which of the following joins will return all records from the both tables despite any resulting null values? self join cross join natural join full join

full join

What is a foreign key? The identifier for the database A column or group of columns that uniquely identify a row A key used to access a secured database table A column that references a column of another table to establish a relationship between rows

A column that references a column of another table to establish a relationship between rows

Which SQL sublanguage is used to change database permissions? DDL DML DCL TCL

DCL

Which SQL sublanguage is used to define tables, schema, and databases? DDL DML DCL TCL

DDL

Which SQL contraint will create a value in the row if no value is provided? DEFAULT CHECK NOT NULL PRIMARY KEY

DEFAULT

What is a dirty read? Reading data that doesn't have a primary key Reading data that is nor normalized Reading data that you don't have permission to read Reading data that is uncommitted

Reading data that is uncommitted

What is a phantom read? Reading new rows that are added during a transaction Reading new tables that are added during a transaction Reading updated rows that are changed during a transaction Reading updated tables that are changed during a transaction

Reading new rows that are added during a transaction

SQL is used to create Relational Databases Functions API servers All of the above

Relational Databases

The CHECK constraint is used to: Filter selected rows with a logical expression Require any values placed in a row to satisfy a logical expression Require any values in a column to satisfy a logical expression Require new data to be manually checked after being commited

Require any values in a column to satisfy a logical expression

Which command dictates the amount of columns we get in a given query? WHERE SELECT HAVING GROUP BY

SELECT

What is the difference between WHERE and HAVING? HAVING performs a conditional check on each column to ensure datatypes are proper before a query executes, whereas WHERE applies immediately. Both can be used interchangeably, it is just a means to apply multiple filter conditions. Simply put, HAVING will ensure a specific order for the data after the WHERE clause applies, whereas WHERE by itself does not order at all. WHERE applies a condition to all records individually, whereas HAVING applies to groupings of records.

WHERE applies a condition to all records individually, whereas HAVING applies to groupings of records.

Which command filters out records from the given query based on applying a condition to each and every record? WHERE. SELECT. HAVING. GROUP BY.

WHERE.

What is a non-repeatable read? When a row is read twice in a transaction and the values are the same When a column is read twice in a transaction and the values are the same When a row is read twice in a transaction and the values are different When a column is read twice in a transaction and the values are different

When a row is read twice in a transaction and the values are different

What are transactions? Only when you add information from a table When you make changes to tables When you make DML statements to information in a table When you create or delete tables

When you make DML statements to information in a table


Kaugnay na mga set ng pag-aaral

Fin 350 Chapter #11 : Life Insurance

View Set

pharm 817- Controlled substances

View Set

Chapter 10 - What is Motivation?

View Set

Practice Questions from Supplement

View Set

Ch. 12: The Reach of Imperialism

View Set

Section 3: Basic Mathematics for Limited Operators

View Set

Molecular and Cellular Biology - Exam 1 Test Bank 3

View Set