• Shuffle
    Toggle On
    Toggle Off
  • Alphabetize
    Toggle On
    Toggle Off
  • Front First
    Toggle On
    Toggle Off
  • Both Sides
    Toggle On
    Toggle Off
  • Read
    Toggle On
    Toggle Off
Reading...
Front

Card Range To Study

through

image

Play button

image

Play button

image

Progress

1/29

Click to flip

Use LEFT and RIGHT arrow keys to navigate between flashcards;

Use UP and DOWN arrow keys to flip the card;

H to show hint;

A reads text to speech;

29 Cards in this Set

  • Front
  • Back

What type of SQL field creates a value of the primary key field automatically every time a new record is inserted?

Auto_Increment

What operator is used to search for a specified pattern in a column?

Like

what type of JOIN returns all rows from table1, with the matching rows in table2 -- FROM table1 _______________ table2 ON table1.column_name=table2.column_name?

Left Join

What type of JOIN selects all rows from two tables as long as there is a match between the columns in both tables?

Inner Join

The GROUP BY statement is used in conjunction with what type of functions to group the result-set by one or more columns?

Aggregate functions (ex: min, max, sum, avg, count)

What type of JOIN returns all rows from Customers and from Orders -- FROM Customers ______________ Orders ON Customers.CustomerID=Orders.CustomerID ORDER BY Customers.CustomerName;?

Full Outer Join

What SQL operator combines the result of two or more SELECT statements?

Union

What is the SQL statement to select all customers with a City of "Paris" or "London"?

SELECT *


FROM Customers


WHERE City IN (‘Paris’, ‘London’);




SELECT *


FROM Customers


WHERE City = ‘Paris’ OR City = ‘London’

If you want to create aliases for the tables Customers and Orders in a SELECT query where Customers.CustomerID=Orders.CustomerID, how would you write the query?

SELECT o.OrderID, o.OrderDate, c.CustomerName


FROM Customers AS c, Orders AS o


WHERE c.CustomerID=o.CustomerID;

What constraint ensures that a field always contains a value?

Not Null

What is the SQL syntax to copy all columns of a table into a backup table?

SELECT *


INTO newtable [IN externaldb]


FROM table1;

What is the SQL statement to select the product name and the price rounded to the nearest integer from the "Products" table?

SELECT ProductName, ROUND(Price,0) AS RoundedPrice


FROM Products;

What values can be used for the range specified with the BETWEEN operator?

Anything in the table, if there’s a null then it returns null

What is the SQL statement to select the product name and price for today from the "Products" table?

SELECT ProductName, Price, Now AS PerDate


FROM Products;

What function returns the number of records in a table?

COUNT

With SQL, how do you select all the records from a table named "Persons" where the "FirstName" is "Joe" and the "LastName" is "Blow"?

SELECT *


FROM Persons


WHERE FirstName = ‘Joe’ AND LastName = ‘Blow’;

With SQL, how do you select all the records from a table named "Persons"?

SELECT *


FROM Persons;

In a table, a column may contain many duplicate values; and you want to list only the different values, what is the SQL syntax?

SELECT DISTINCT columnname, columnname


FROM table;

With SQL, how do you select all the records from a table named "Persons" where the "LastName" is alphabetically between (and including) "Jones" and "Smith" ?

SELECT *


FROM Persons


WHERE LastName BETWEEN ‘Jones’ AND ‘Smith’;

Can you use both HAVING and WHERE SQL clauses in a single SQL statement?

Yes if you want to filter out individual rows before grouping them, start with where and then use a group by statement and having clause

Which SQL statement selects all rows from a table called Products and orders the result set by ProductID column?

SELECT *


FROM ProductsORDER BY ProductID;

Which SQL keyword is used to retrieve the greatest/highest value?

MAX

With SQL, how can you return all the records from a table named "Persons" sorted descending by "FirstName"?

SELECT *


FROM Persons ORDER BY FirstName DESC;

When does the OR operator displays a record?

First condition


OR


Second condition is true

Which SQL statement is used to return only different values?

SELECT DISTINCT

Which SQL keyword is used to sort the result-set?

ORDER BY

With SQL, how can you insert "Olsen" as the "LastName" in the "Persons" table?

INSERT INTO Persons (LastName)VALUES (‘Olsen’);

With SQL, how can you insert a new record into the "Persons" table?

INSERT INTO Persons (column1, column2)


VALUES (value1, value2);

How can you change "Hansen" into "Nilsen" in the "LastName" column in the Persons table?

UPDATE Persons SET LastName = ‘Nilsen’


WHERE LastName = ‘Hansen’;