SELECT DISTINCT column_name, column_name, ...
FROM table_name;
Back
IN Clause
Front
The IN operator allows you to specify multiple values in a WHERE clause.
where table.column is in:
set{blah1,blah2,....}
Back
Example syntax of SELECT TOP
Front
SELECT TOP example syntax:
SELECT TOP number|percent column_name(s)
FROM table_name;
Back
What is the UNION operator used for?
Front
The UNION operator is used to combine the result-set of two or more SELECT statements.
Back
How do you separate the duplicate Values from a Column?
Front
You can list only the different (distinct) values, using the DISTINCT Statement
Back
What is the WHERE Clause used for?
Front
The WHERE clause is used to extract only those records that fulfill a specified criterion.
Back
What does the FULL OUTER JOIN keyword return?
Front
The FULL OUTER JOIN keyword returns all rows from the left table (table1) and from the right table (table2).
Back
Example of INSERT INTO statement
Front
INSERT INTO Example:
INSERT INTO table_name
VALUES (value1,value2,value3,...);
INSERT INTO table_name (column1,column2,column3,...)
VALUES (value1,value2,value3,...);
Back
Example of FULL OUTER JOIN syntax:
Front
Example of FULL OUTER JOIN syntax:
SELECT column_name(s)
FROM table1
FULL OUTER JOIN table2
ON table1.column_name=table2.column_name;
Back
Does the UNION operator needs to have the same number of columns?
Front
Yes, the UNION operator needs to have the same number of columns.
Notice that each SELECT statement within the UNION must have the same number of columns AND datatypes
Back
What is the purpose of WHERE in the DELETE statement?
Front
The WHERE clause specifies which record or records that should be deleted.
Back
Can you have ORDER by Desc value?
Front
Yes, To sort the records in a descending order, you can use the DESC keyword.
Back
What does the RIGHT JOIN do?
Front
The RIGHT JOIN keyword returns all rows from the right table (table2), with the matching rows in the left table (table1).
returns vals on
Back
What happens if there is no match on the left side with the RIGHT JOIN?
Front
NULL - The result is NULL in the left side when there is no match.
Back
What is CRUD?
Front
Create,
Read,
Update
Delete
Back
What is the function of the Semicolon in SQL?
Front
separates each SQL statement
Back
Besides UNION needing to have the same number of columns is there anything else that needs to be similar?
Front
Data TYPES, and Order
Yes, The columns must also have similar data types. Also, the columns in each SELECT statement must be in the same order.
Back
Example of Aliases (AS) syntax:
Front
Example of Aliases (AS) syntax:
SELECT column_name AS alias_name
FROM table_name;
SELECT column_name(s)
FROM table_name AS alias_name;
Back
Example of UPDATE statement
Front
Update Example:
UPDATE table_name
SET column1=value1,column2=value2,...
WHERE some_column=some_value;
Back
What are the AND/OR Operators used for?
Front
The AND & OR operators are used to filter records based on more than one condition.
Back
What happens on the LEFT JOIN if there is no match in the right side?
Front
NULL - The result is NULL in the right side when there is no match.
Back
Example of INSERT INTO syntax:
Front
Example of INSERT INTO syntax:
INSERT INTO table2
SELECT * FROM table1;
INSERT INTO table2
(column_name(s))
SELECT column_name(s)
FROM table1;
Back
In an INSERT INTO are all rows affected?
Front
No, Any existing rows in the target table are unaffected.
Back
What is the LIKE Operator used for?
Front
The LIKE operator is used to search for a specified pattern in a column containing a string
Back
Example of RIGHT JOIN syntax:
Front
Example of RIGHT JOIN syntax:
SELECT column_name(s)
FROM table1
RIGHT JOIN table2
ON table1.column_name=table2.column_name;
Back
What is the ORDER BY Keyword used for?
Front
The ORDER BY keyword is used to sort the result-set by one or more columns.
SELECT column_name, column_name
FROM table_name
ORDER BY column_name ASC|DESC, column_name ASC|DESC;
Back
WHERE clause syntax:
Front
WHERE Syntax:
SELECT column_name,column_name
FROM table_name
WHERE column_name operator value;
Back
What happens if you use the UPDATE statement without the WHERE?
Front
All Records are updated.
Back
Example of LEFT JOIN syntax:
Front
Example of LEFT JOIN syntax:
SELECT column_name(s)
FROM table1
LEFT JOIN table2
ON table1.column_name=table2.column_name;
Back
What is the INNER JOIN keyword do?
Front
The INNER JOIN keyword selects all rows from both tables as long as there is a match between the columns in both tables.
Back
What is the SELECT TOP Clause used for?
Front
The SELECT TOP clause is used to specify the number of records to return.
Back
What is the SELECT Statement Syntax?
Front
SELECT column_name, column_name
FROM table_name;
Back
What is the BETWEEN operator do?
Front
The BETWEEN operator selects numerical values within a range.
Back
What happens if you omit the WHERE clause in the DELETE statement?
Front
If you omit the WHERE clause, all records will be deleted!
Back
Example of INNER JOIN keyword:
Front
Example of INNER JOIN keyword:
SELECT column_name(s)
FROM table1
INNER JOIN table2
ON table1.column_name=table2.column_name;
SELECT column_name(s)
FROM table1
JOIN table2
ON table1.column_name=table2.column_name;
Back
What is the default order in the ORDER keyword?
Front
The ORDER BY keyword sorts the records in ascending order by default.
Back
What does the LEFT JOIN do?
Front
The LEFT JOIN keyword returns all rows from the left table (table1), with the matching rows in the right table (table2).
Will return null if no vals found in right
Back
Example of OR operator
Front
Example of OR Syntax:
SELECT * FROM Customers
WHERE Country='Germany'
AND (City='Berlin' OR City='München');
Back
What are the values that BETWEEN operator can handle?
Front
Numbers, Text, or Dates.
The values handled by the BETWEEN operator can be numbers, text, or dates.
Back
How do you separate the duplicate Values from a Column?
Front
You can list only the different (distinct) values, using the DISTINCT Statement
Back
Example of SELECT INTO syntax:
Front
Example of SELECT INTO syntax:
SELECT *
INTO newtable [IN externaldb]
FROM table1;
SELECT column_name(s)
INTO newtable [IN externaldb]
FROM table1;
Back
What does the SELECT INTO do?
Front
The SELECT INTO statement selects data from one table and inserts it into a new table.
Back
Is the FULL OUTER JOIN a combination of both LEFT and RIGHT join?
Front
Yes, The FULL OUTER JOIN keyword combines the result of both LEFT and RIGHT joins.
Back
What are the Aliases (AS) used for?
Front
SQL aliases are used to give a database table, or a column in a table, a temporary name.
Back
Example of LIKE operator syntax
Front
LIKE operator syntax example:
SELECT column_name(s)
FROM table_name
WHERE column_name IN (value1,value2,...);
SELECT * FROM Customers
WHERE City IN ('Paris','London');
Back
Example of BETWEEN operator syntax:
Front
BETWEEN operator syntax:
SELECT column_name(s)
FROM table_name
WHERE column_name BETWEEN value1 AND value2;
Back
Are SQL queries case sensitive?
Front
SQL keywords are NOT case sensitive
Back
Example of UNION syntax:
Front
Example of UNION syntax:
SELECT column_name(s) FROM table1
UNION
SELECT column_name(s) FROM table2;
Back
Why are all Records updated if you omit the WHERE in the UPDATE Statement?u
Front
The WHERE clause specifies which record or records that should be updated. If you omit the WHERE clause, all records will be updated!
Back
What does the INSERT INTO do?
Front
The INSERT INTO SELECT statement selects data from one table and inserts it into an existing table.
Back
Section 2
(50 cards)
How is the type TIMESTAMP in SQL structured?
Front
The type TIMESTAMP is formatted like: A Unique Number
Back
Example of NOT NULL Syntax:
Front
Example of NOT NULL Syntax:
CREATE TABLE PersonsNotNull
(
P_Id int NOT NULL,
LastName varchar(255) NOT NULL,
FirstName varchar(255),
Address varchar(255),
City varchar(255)
)
Back
What are SQL constraints used for?
Front
SQL constraints are used to specify rules for the data in a table.
Back
What happens with a constraint violation?
Front
action is aborted
Back
Example of CREATE DATABASE syntax:
Front
Example of CREATE DATABASE syntax:
CREATE DATABASE dbname;
Back
Where will the DEFAULT constrain add the values?
Front
The default value will be added to all new records, if no other value is specified.
Back
What is a FOREIGN KEY?
Front
points to a PRIMARY KEY of another table.
Back
What is the CREATE INDEX used for?
Front
The CREATE INDEX statement is used to create indexes in tables.
Back
How is the type DATE in SQL structured?
Front
The type DATE is formatted like: YYYY-MM-DD
Back
Does SQL Dates come already with some predefined types for defining and storing a date or a date / time value?
Front
Yes, there are some already predefined date types.
Back
So if there is a delay on updating a table with index when should we used indexes?
Front
You should only create indexes on columns (and tables) that will be frequently searched against.
Back
What is a View?
Front
A view is a virtual table based on the result-set of an SQL statement
Back
What is the ALTER statement used for?
Front
The ALTER TABLE statement is used to add, delete, or modify columns in an existing table.
Back
What does the UNIQUE Constraint do?
Front
applies constraint that each value in specified column must be unique
Back
What are the INDEXES used for?
Front
Indexes allow the database application to find data fast; without reading the whole table.
Back
How would you remove a column in a table with ALTER?
Front
To remove a column in a table, use the following syntax:
ALTER TABLE table_name
DROP COLUMN column_name
Back
Example of a CREATE VIEW syntax:
Front
Example of a CREATE VIEW syntax:
CREATE VIEW view_name AS
SELECT column_name(s)
FROM table_name
WHERE condition
Back
Example of UDPATE VIEW syntax:
Front
Example of UDPATE VIEW syntax:
CREATE OR REPLACE VIEW view_name AS
SELECT column_name(s)
FROM table_name
WHERE condition
Back
What does the NOT NULL Constraint do?
Front
enforces a column to NOT accept NULL values
Back
When creating a table how are tables organized?
Front
Tables are organized into rows and columns; and each table must have a name.
Back
Example of DROP Syntax:
Front
Example of DROP Syntax:
DROP INDEX table_name.index_name
DROP DATABASE database_name
Back
Example of DEFAULT constraint syntax:
Front
Example of DEFAULT constraint syntax:
CREATE TABLE Persons (
P_Id int NOT NULL,
LastName varchar(255) NOT NULL,
FirstName varchar(255),
Address varchar(255),
City varchar(255) DEFAULT 'Sandnes'
);
Back
Why would we use the AUTO INCREMENT?
Front
Automatically create the value of Primary Key
Very often we would like the value of the primary key field to be created automatically every time a new record is inserted.
Back
What does a VIEW contain?
Front
A view contains rows and columns, just like a real table.
Back
Does a PRIMARY KEY Constraint automatically has a UNIQUE constraint?
Front
Yes, A PRIMARY KEY constraint automatically has a UNIQUE constraint defined on it.
Back
Can you add SQL functions to a view?
Front
Yes, You can add SQL functions, WHERE, and JOIN statements to a view and present the data as if the data were coming from one single table.
Back
What are the types of Data types for storing a date or a date / time value in a database?
Front
There are some types for storing a date or date / time value in the database:
DATE - format YYYY-MM-DD
DATETIME - format: YYYY-MM-DD HH:MI:SS
SMALLDATETIME - format: YYYY-MM-DD HH:MI:SS
TIMESTAMP - format: a unique number
Back
What is the most difficult part of working with SQL dates?
Front
The most difficult part when working with dates is to be sure that the format of the date you are trying to insert, matches the format of the date column in the database.
Back
What is the DEFAULT Constraint used for?
Front
The DEFAULT constraint is used to insert a default value into a column.
Back
Is the update time of a table with indexes the same as the update time without indexes?
Front
No, the update time is not the same, Updating a table with indexes takes more time than updating a table without (because the indexes also need an update).
Back
Example of CREATE INDEX syntax:
Front
Example of CREATE INDEX syntax:
CREATE INDEX index_name
ON table_name (column_name)
Back
Example of a PRIMARY KEY syntax:
Front
Example of a PRIMARY KEY syntax:
CREATE TABLE Persons
(
P_Id int NOT NULL PRIMARY KEY,
LastName varchar(255) NOT NULL,
FirstName varchar(255),
Address varchar(255),
City varchar(255)
)
Back
How would you add a column in a table with ALTER?
Front
To add a column in a table, use the following syntax:
ALTER TABLE table_name
ADD column_name datatype
Back
How many primary keys can a table have?
Front
one
Back
Can you INSERT / UPDATE a new record on a NOT NULL without adding a value to this field?
Front
No, this is the whole point of NOT NULL, This means that you cannot insert a new record, or update a record without adding a value to this field.
Back
What does the AUTO INCREMENT used for?
Front
Auto-increment allows a unique number to be generated when a new record is inserted into a table.
Back
How is the type SMALLDATETIME in SQL structured?
Front
The type SMALLDATETIME is formatted like: YYYY-MM-DD HH:MI:SS
Back
Example of creating a table Syntax:
Front
Example of creating a table Syntax:
CREATE TABLE table_name
(
column_name1 data_type(size),
column_name2 data_type(size),
column_name3 data_type(size),
....
);
Back
What do Null Values represent?
Front
NULL values represent missing unknown data. By default, a table column can hold NULL values
Back
Example of a SQL Constrain syntax:
Front
Example of a SQL Constrain syntax:
CREATE TABLE table_name
(
column_name1 data_type(size) constraint_name,
column_name2 data_type(size) constraint_name,
column_name3 data_type(size) constraint_name,
....
);
Back
Example of a FOREIGN KEY Syntax
Front
Example of a FOREIGN KEY Syntax
CREATE TABLE Orders
(
O_Id int NOT NULL,
OrderNo int NOT NULL,
P_Id int,
PRIMARY KEY (O_Id),
FOREIGN KEY (P_Id) REFERENCES Persons(P_Id)
)
Back
Can SQL Constraints be specified when a table is Created?
Front
Yes, Constraints can be specified when the table is created (inside the CREATE TABLE statement) or after the table is created (inside the ALTER TABLE statement).
Back
CHECK Constrain on a Single Column:
Front
If you define a CHECK constraint on a single column it allows only certain values for this column.
Back
Example of AUTO INCREMENT syntax:
Front
Example of AUTO INCREMENT syntax:
CREATE TABLE Persons
(
ID int IDENTITY(1,1) PRIMARY KEY,
LastName varchar(255) NOT NULL,
FirstName varchar(255),
Address varchar(255),
City varchar(255)
)
Back
What is the CHECK Constraint used for?
Front
The CHECK constraint is used to limit the value range that can be placed in a column.
Back
How is the type DATETIME in SQL structured?
Front
The type DATETIME is formatted like: YYYY-MM-DD HH:MI:SS
Back
What happens if you define a CHECK constraint on a table?
Front
If you define a CHECK constraint on a table it can limit the values in certain columns based on values in other columns in the row.
Back
Example of UNIQUE Constrain Syntax:
Front
Example of UNIQUE Constrain Syntax:
CREATE TABLE Persons
(
P_Id int NOT NULL UNIQUE,
LastName varchar(255) NOT NULL,
FirstName varchar(255),
Address varchar(255),
City varchar(255)
)
Back
What is the DROP statement used for?
Front
Indexes, tables, and databases can easily be deleted/removed with the DROP statement.
Back
Example of CHECK constraint Syntax:
Front
Example of CHECK constraint Syntax:
CREATE TABLE Persons
(
P_Id int NOT NULL CHECK (P_Id>0),
LastName varchar(255) NOT NULL,
FirstName varchar(255),
Address varchar(255),
City varchar(255)
)
Back
Section 3
(50 cards)
Data Type: Real
Front
Approximate numerical, mantissa precision 7
real
Back
What does the First Function Return?
Front
The FIRST() function returns the first value of the selected column. Only in MS Access
Back
Example of HAVING Function Syntax:
Front
Example of HAVING Function Syntax:
SELECT column_name, aggregate_function(column_name)
FROM table_name
WHERE column_name operator value
GROUP BY column_name
HAVING aggregate_function(column_name) operator value;
Back
What does the Sum Function Return?
Front
The SUM() function returns the SUM of the values of the selected column.
Back
Example of mid Syntax:
Front
Example of mid Syntax:
SELECT MID(column_name,start,length) AS some_name FROM table_name;
Back
Data Type: Aray
Front
A set-length and ordered collection of elements
Back
What is the Mid Function used for?
Front
The MID() function is used to extract characters from a text field.
Back
Example of Sum Function Syntax:
Front
Example of Sum Function Syntax:
SELECT MIN(column_name) FROM table_name;
Back
What is a Subquery?
Front
A subquery is a SQL query nested inside a larger query.
Back
Data Type: Timestamp
Front
Stores year, month, day, hour, minute, and second values
timestamp
Back
What does a Count Function Return?
Front
The COUNT() function returns the number of rows that matches a specified criteria.
Back
Example of an Average Function Syntax:
Front
Example of an Average Function Syntax:
SELECT AVG(column_name) FROM table_name
Back
AVG()
Front
average of numeric column for several rows
Back
Example of Length syntax
Front
Example of Length syntax
SELECT LENGTH(column_name) FROM table_name;
Back
What is the Round Function used for?
Front
The ROUND() function is used to round a numeric field to the number of decimals specified.
Back
Example of First Function Syntax:
Front
Example of First Function Syntax:
SELECT FIRST(column_name) FROM table_name;
Back
What does the Lower Case Function do?
Front
The LCASE() function converts the value of a field to lowercase.
Back
Data Type: Time
Front
Stores hour, minute, and second values
time
Back
Example of LAST Function Syntax
Front
Example of LAST Function Syntax
SELECT LAST(column_name) FROM table_name;
Back
Data Type: Decimal
Front
Exact numerical, precision p, scale s. Example: decimal(5,2) is a number that has 3 digits before the decimal and 2 digits after the decimal.
decimal(6,2)
Back
What does the Now Function return?
Front
The NOW() function returns the current system date and time.
Back
Example of Round Function Syntax:
Front
Example of Round Function Syntax:
SELECT ROUND(column_name,decimals) FROM table_name;
Back
Example of a Subquery Syntax
Front
Example of a Subquery Syntax
SELECT a.studentid, a.name, b.total_marks
FROM student a, marks b
WHERE a.studentid = b.studentid AND b.total_marks >
(SELECT total_marks
FROM marks
WHERE studentid = 'V002');
Back
'Having' is used by why kind of SQL?
Front
aggregate functions
Back
What does the Last Function Return?
Front
The LAST() function returns the last value of the selected column. Only in MS Access
Back
Data Type: Binary Object
Front
Binary string. Fixed-length n
Syntax:
Blob
Text
Fixed Length Syntax:
Binary (fixed up to 8K)
Varbinary (<8K)
Image (<2GB)
Back
What is a Intersect?
Front
A Intersect is the Same as INNER JOIN
Back
Where is the Group By Function used?
Front
The GROUP BY statement is used in conjunction with the aggregate functions to group the result-set by one or more columns.
Back
Example of LCASE syntax:
Front
Example of LCASE syntax:
SELECT LOWER(column_name) FROM table_name;
Back
Data Type: Variable Character
Front
Character string. Variable length. Maximum length n
varchar(n)
Back
What if a column in a table is Optional?
Front
If a column in a table is optional, we can insert a new record or update an existing record without adding a value to this column. This means that the field will be saved with a NULL value.
Back
What does the Min Function Return?
Front
The MIN() function returns the smallest value of the selected column.
Back
Example of NULL syntax:
Front
Example of NULL syntax:
SELECT LastName,FirstName,Address FROM Persons
WHERE Address IS NULL
SELECT LastName,FirstName,Address FROM Persons
WHERE Address IS NOT NULL
Back
Data Type: Date
Front
Stores year, month, and day values
date
Back
Example of UCASE Function Syntax:
Front
Example of UCASE Function Syntax:
SELECT UPPER(column_name) FROM table_name;
Back
Example of Now Function Syntax
Front
Example of Now Function Syntax
SELECT NOW() FROM table_name;
Back
Data Type: Integer
Front
Integer numerical (no decimal). Precision p
int
Back
What does the Max Function Return?
Front
The MAX() function returns the largest value of the selected column.
Back
Why was the HAVING Function added to SQL?
Front
The HAVING clause was added to SQL because the WHERE keyword could not be used with aggregate functions.
Back
How is the Round Function processed? is there any rule to be aware of?
Front
IEEE 754, Many database systems have adopted the IEEE 754 standard for arithmetic operations, according to which the default rounding behavior is "round half to even." In this scheme, .5 is rounded to the nearest even integer. So, both 11.5 and 12.5 would be rounded to 12.
Example of MAX Function Syntax:
SELECT MAX(column_name) FROM table_name;
Back
Example of MIN function Syntax:
Front
Example of MIN function Syntax:
SELECT MIN(column_name) FROM table_name;
Back
Data Type: Boolean
Front
Stores TRUE or FALSE values
boolean
Back
Example of GROUP by Function Syntax:
Front
Example of GROUP by Function Syntax:
SELECT column_name, aggregate_function(column_name)
FROM table_name
WHERE column_name operator value
GROUP BY column_name;
Back
What is the Length Function used for?
Front
The LEN() function returns the length of the value in a text field.
Back
What is the Format Function used for?
Front
The FORMAT() function is used to format how a field is to be displayed.
SELECT FORMAT(column_name,format) FROM table_name;
Back
What does a COUNT(column_name) function Return?
Front
The COUNT(column_name) function returns the number of values (NULL values will not be counted) of the specified column
Back
Example of a COUNT function syntax:
Front
Example of a COUNT function syntax:
SELECT COUNT(column_name) FROM table_name;
Back
Section 4
(50 cards)
What is the result of a FULL JOIN?
Front
The result of a FULL JOIN is equivalent to performing a UNION of the results of left and right outer queries.
ex: Produces the set of all records in Table A and Table B, with matching records from both sides if available. If no match, missing side will contain null.
Back
What does the SIGN(x) return?
Front
Returns the sign of input x as -1,0,1
Back
Is there more than one way to specify a CROSS JOIN?
Front
Yes, a CROSS JOIN can either be specified using the CROSS JOIN syntax ("explicit join notation") or (b) listing the tables in the FROM clause separated by commas without using a WHERE clause to supply join criteria ("implicit join notation").
Back
What will the RIGHT JOIN give if the ON clause doesn't match any records in the left table?
Front
If the ON clause doesn't match any records in the left table, the RIGHT JOIN will still return a row in the result for that record in the right table, but with NULL in each column from the left table.
Back
What is a Schema?
Front
A schema is a collection of database objects (tables) associated with one particular database username.
Back
COUNT(*) - Aggregate fxn
Front
Returns the number of rows in a table
Back
Is a LEFT JOIN the same as LEFT OUTER JOIN?
Front
Yes, a left join can also be referred as a left outer join
Back
What is Data type: char(size)
Front
It's the Fixed-length character string.
Size specified in parentheses. 255
Back
What does a RIGHT JOIN Return?
Front
A RIGHT JOIN Returns all rows from the right table, and the matched rows from the left table. This is the exact opposite of a LEFT JOIN;
Back
What will be the result of a LEFT JOIN if the ON clause doesn't match any records in the right table?
Front
If the ON clause doesn't match any records in the right table, the LEFT JOIN will still return a row in the result for that record in the left table, but with NULL in each column from the right table.
Back
Could you say that a FULL JOIN is a combination of the LEFT AND RIGHT JOIN?
Front
Yes, Conceptually, a FULL JOIN combines the effect of applying both a LEFT JOIN and a RIGHT JOIN;
Back
When do you want to use an Intersect?
Front
Use an Intersect to return only values that are in the first query AND also in the second query.
Back
What does the ABS(x) return?
Front
Returns the absolute value of x
Back
COUNT- Aggregate fxn
Front
Returns the total number of values in a given column
Back
What does a FULL JOIN return?
Front
A FULL JOIN Returns all rows for which there is a match in EITHER of the tables.
Back
Example of HAVING clause, GROUP BY syntax
Front
Example of HAVING clause, GROUP BY syntax
SELECT column1,
SUM(column2)
FROM "list-of-tables"
GROUP BY "column-list"
HAVING "condition";
Back
HAVING clause, GROUP BY
Front
Allows you to specify conditions on the rows for each group- in other words, which rows should be selected will be based on the conditions you specify
needs to follow GROUP BY clause
Back
What will be the results of a RIGHT JOIN
Front
The results of a RIGHT JOIN will contain all records from the right table, even if the JOIN condition doesn't find any matching records in the left table.
Back
Is a FULL JOIN the same as FULL OUTER JOIN?
Front
Yes, a FULL JOIN is the same as FULL OUTER JOIN
Back
What is the default type of join if no specific JOIN type is specified?
Front
Inner Join,
This is the default type of join if no specific JOIN type is specified.
Back
What is the DELETE statement used for?
Front
The DELETE statement is used to delete records or rows from the table
Back
What does the MAX Return?
Front
Returns the largest value in a given column
Back
Can you use an <= less than as a conditional selection for the SELECT clause?
Front
Yes, you can use an <= less than as a conditional selection for the SELECT clause
Back
What does UNION do?
Front
UNION merges the contents of two structurally-compatible tables into a single combined table.
Back
What are the different types of JOIN clauses supported by the ANSI- standard?
Front
(1) Inner Join
(2) Left Join
(3) Right Join
(4) Full Join
(5) Cross Join
Back
What will be the results of a LEFT JOIN?
Front
the results of a LEFT JOIN, will contain all records from the left table, even if the JOIN condition doesn't find any matching records in the right table.
Back
What is a Data type: number(size)
Front
Number value with a max number of column digits specified in parenthesis.
Back
What does the FLOOR(x) return?
Front
Returns the largest integer value that is less than or equal to x
Back
Example of an INSERT INTO statement
Front
Example of an INSERT INTO statement
insert into "tablename"
(first_column,...last_column)
values (first_value,...last_value);
Back
Mathematical Functions
Front
Mathematical Functions Include:
+, -, *, /, %
Back
What does the CEILING(x), CEIL(x) return?
Front
Returns the smallest integer value that is greater than or equal to x
Back
What does the MOD(x,y) return?
Front
Modulo- returns the integer remainder of x divided by y (same as x%y)
Back
What does a CROSS JOIN return?
Front
A CROSS JOIN returns all records where each row from the first table is combined with each row from the second table (i.e., returns the Cartesian product of the sets of rows from the joined tables).
Back
Can you use an LIKE as a conditional selection for the SELECT clause?
Front
Yes, you can use an LIKE as a conditional selection for the SELECT clause
Back
Can you use an > greater than as a conditional selection for the SELECT clause?
Front
Yes, you can use an > greater than as a conditional selection for the SELECT clause
Back
Can you use an >= greater or equal than as a conditional selection for the SELECT clause?
Front
Yes, you can use an >= greater or equal than as a conditional selection for the SELECT clause
Back
What does the MIN Return?
Front
Returns the smallest value in a given column
Back
What does a LEFT JOIN return?
Front
A left join returns all rows from the left table, and the matched rows from the right table;
Back
Can you use an <> not equal as a conditional selection for the SELECT clause?
Front
Yes, you can use an <> not equal as a conditional selection for the SELECT clause
Back
What is a Data type: varchar(size)
Front
Variable-length character string.
Max size is specified in parenthesis.
Back
Describe an Inner Join
Front
A inner join is a simple join that returns all rows for which there is at least one match in BOTH tables.
Back
Conditional selections used in the where clause for SELECT
Front
= Equal
> Greater than
< Less than
>= Greater than or equal
<= Less than or equal
<> Not equal to
LIKE
Back
Example of a JOIN syntax
Front
If you have a Table A and a Table B
SELECT * FROM TableA
INNER JOIN TableB
ON TableA."col" = TableB."col"
produces only the set of records that match in both A and B
Back
What is the difference between UNION and UNION ALL?
Front
The difference between UNION and UNION ALL is that UNION will omit duplicate records whereas UNION ALL will include duplicate records.
Back
In a Schema what is a Database Username
Front
This username is called the schema owner, or the owner of the related group of objects.
Back
What does limit the user access to the Database?
Front
The user access is limited by the user's privileges within the database, the user has control over objects that are created, manipulated, and deleted.
Back
Can you use an = equal as a conditional selection for the SELECT clause?
Front
Yes, you can use an = equal as a conditional selection for the SELECT clause
Back
When a user creates an Object did he just created his own Schema?
Front
Yes, Basically, any user who creates an object has just created his or her own schema.
Back
Can you have multiple Schemas in a Database?
Front
Yes, You may have one or multiple schemas in a database.
Back
Data type: number (size,d)
Front
Number value with a maximum number of digits of "size" total, with a max number of "d" digits to the right of the decimal.
Back
Section 5
(26 cards)
WHERE clause filters what type of data?
Front
Non Aggregates
Back
What does the ROUND(x) return?
Front
Returns the value of x rounded to the nearest whole integer
Back
Example of TABLE JOIN syntax
Front
SELECT "list-of-columns"
FROM table1,table2
WHERE "search-condition(s)"
Back
Blob
Front
Binary Large Object, unstructured data in a database.
Back
INTERSECT
Front
Back
What are the major benefits of transactions?
Front
Speed of committing large block of writes to disk at once.
The ability to rollback if one part fails.
Back
UNION
Front
Back
Natural Key
Business Key
Front
Back
How do you compare two null values?
Front
Using IS NULL or..
NVL( test1, 'equal' ) = NVL( test2, 'equal' ) -> True if both NULL
Back
How do Aggregate functions handle nulls?
Front
In general they disregard nulls, however some like MAX()/MIN() may return null if every value is null.
Back
LIMIT vs TOP
Front
Both functions will return a set number of records and function the same.
Back
HAVING clause filters what type of data?
Front
Aggregate data
Back
What does the SQRT(x) return?
Front
Returns the square-root value of x
Back
What does the POWER(x,y) return?
Front
Returns the value of x raised to the power of y
Back
case statement
Front
Back
Arithmetic operators
Concatenation operator
Comparison conditions
IS [NOT] NULL, LIKE, [NOT] IN
[NOT] BETWEEN
Not equal to
NOT logical condition
AND logical condition
OR logical condition
You can use parentheses to override rules of precedence.
Front
Back
Triggers
Front
Can be used to prevent changes to rows/tables on conditions, or creating timestamps.
Back
Why can you not compare two Null values using = operator?
Front
You cannot mathematically compare two NON existent values
Back
What does the ROUND(x,d) return?
Front
Returns the value of x rounded to the number of decimal places specified by the value d
Back
Synthetic Key
Surrogate Key
Front
A system-generated primary key that is usually hidden from users, and is not derived from application data.
Typically a 4 byte Int that is auto incremented.
Back
What is a Transaction?
Front
A group of operations that depend on each other in a database, which will fail and roll back if a single part fails.
Back
HAVING keyword
Front
Back
Difference between primary and unique key?
Front
A unique key cannot be used for primary keys because they allow for nulls.
Back
Presedence of AND/OR/NOT
Front
Back
correlated subquery
Front
In SQL, a subquery in which processing the inner query depends on data from the outer query.
Back
What does DISTINCT return when used for multiple columns?