practice sql

अब Quizwiz के साथ अपने होमवर्क और परीक्षाओं को एस करें!

With SQL, how do you select a column named "FirstName" from a table named "Persons"? a. select FirstName from Persons b. Get FirstName from Persons c. select Persons.Firstname

A

Which SQL statement lets you find the sales amount for each store: Table SALES Column name -STORE_ID -STORES_DATE -SALES_AMOUNT a. SELECT STORE_ID, SUM(SALES_AMOUNT) FROM SALES GROUP BY STORE_ID; b. SELECT STORE_ID, SUM(SALES_AMOUNT) FROM SALES ORDER BY STORE_ID; c. SELECT STORE_ID, SUM(SALES_AMOUNT) FROM SALES HAVING UNIQUE STORE_ID; d. SELECT STORE_ID, SUM(SALES_AMOUNT) FROM SALES;

A. SELECT STORE_ID, SUM(SALES_AMOUNT) FROM SALES GROUP BY STORE_ID;

Which SQL statement is used in order to change the structure of a table?

ALTER

What are the aggregate functions?

AVG, CHECKSUM_AGG, COUNT, COUNT_BIG, MAX, MIN, STDEV, STDEVP, SUM, VAR, VARP

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

D. All of the Above

Transaction Control Statements manages changes made by which type of statements?

DML

What type of SQL statements are used for managing data within tables?

Data Manipulation Language (DML)

(T or F) It is generally acceptable practice to code database credentials directly into the DriverManager.getConnection() parameters

False

(T or F) It is not necessary to call the close() method on a connection, it does not consume resources unless it is actively being used

False

(T or F) The cursor of a ResultSet begins on the first element

False

(T or F) The executeQuery() method is used to send SQL UPDATE statements to the db

False

The Check constraint ensures each row for that column must have a unique value

False

The DELETE statement is used to delete an entire table or database

False

The NOT NULL constraint ensures the value in that column meets a specific condition

False

Which constraint is used to reference a primary key of another table?

Foreign key

Which SELECT clause gathers all rows together that contain data in specified columns

GROUP BY

Which SQL statement is used to insert data into a database?

INSERT INTO

The SQL keyword __________ is used with wildcards

Like

Which is not a JDBC statement? A. PreparedStatement B. Statement C. CallableStatement D. MacroStatement

MacroStatement

Which SQL keyword is used to sort the result set?

ORDER BY

Which constraint is used to uniquely identify each row?

Primary key

With SQL, how do you select all the records from a table named "Persons" where the value of the column "FirstName" starts with an "a"?

SELECT * FROM Persons WHERE FirstName LIKE 'a%';

With SQL, how can you return the number of records in the "Persons" table?

SELECT COUNT(*) FROM PERSONS

What SQL statement is used to extract data from a database?

Select

How should you reference your DAO in your source code? interface StudentDAO {...} class JdbcStudentDAO implements StudentDAO {...}

StudentDAO dao = new JdbcStudentDAO();

(T or F) A statement has no innate protection against SQL injection

True

(T or F) Data Definition Language statements are used to define database structure or schema

True

(T or F) Every db needs its own driver, to translate JDBC commands into something the db can understand

True

(T or F) The DAO pattern helps decouple your application's business layer from its data access layer

True

The INNER JOIN is used in order to return all rows and selected columns which satisfy a certain condition

True

Transaction Control Statements manage changes made by DML statements

True

Which of the following is NOT a type of SQL constraint? a. UNIQUE b. FOREIGN KEY c. PRIMARY KEY d. ALTERNATE KEY

d. ALTERNATE KEY


संबंधित स्टडी सेट्स

Abeka World Literature Appendix Quiz E

View Set

Fences: Act 1 Scene 1 Characters and Events

View Set

Ch. 14: Oligopoly & Strategic Behavior

View Set

Comptia A+ 1101 & 1102 practice questions official

View Set

NT1110 Computer Structure and Logic Chpt 2 Quiz

View Set