The AND & OR operators are used to filter records based on more than one condition.
Back
Can SQL update records in a database?
Front
Yes, SQL can update records in a database
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
Can a column contain duplicate Values?
Front
Yes a column can contain Duplicate Values
Back
Can SQL set permissions on tables, procedures, and views?
Front
Yes, SQL can set permissions on tables, procedures, and views
Back
Can SQL execute queries against a database?
Front
Yes, SQL can execute queries against a database
Back
What does the U in CRUD stand for?
Front
Update, U in CRUD, stands for Update and is on of the four basic functions of persistent storage.
Back
Can SQL create stored procedures in a database?
Front
Yes, SQL can create stored procedures in a database
Back
What is SQL?
Front
SQL stands for Structured Query Language. SQL lets you access and manipulate databases.
Back
What are the four basic functions of persistent storage?
Front
The four basic functions of persistent storage can be defined by acronym CRUD
Back
What does the D in CRUD stand for?
Front
Delete, D in CRUD, stands for Delete and is on of the four basic functions of persistent storage.
Back
Why are all Records updated if you omit the WHERE in the UPDATE Statement?
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
Where is the data stored in RDBMS?
Front
The data in RDBMS is stored in database objects called tables.
Back
Can SQL can insert records in a database?
Front
Yes, SQL can insert records in a database
Back
WHERE clause syntax:
Front
WHERE Syntax:
SELECT column_name,column_name
FROM table_name
WHERE column_name operator value;
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 is the INSERT INTO Statement used for?
Front
The INSERT INTO statement is used to insert new records in a table.
Back
What is the SELECT Statement Syntax?
Front
SELECT column_name, column_name
FROM table_name;
SELECT * FROM table_name;
Back
Can SQL retrieve data from a database?
Front
Yes, SQL can retrieve data from a database
Back
What does the R in CRUD stand for?
Front
Read/Retrieve (Select), R in CRUD, stand for Read/Retrieve (Select) and is on of the four basic functions of persistent storage.
Back
Can SQL create new databases?
Front
Yes, SQL can create new databases
Back
Example of UPDATE statement
Front
Update Example:
UPDATE table_name
SET column1=value1,column2=value2,...
WHERE some_column=some_value;
Back
Does the SELECT TOP clause has any utility on large tables?
Front
Yes, the SELECT TOP clause can be very useful on large tables with thousands of records.
Back
What can SQL do?
Front
SQL can execute queries against a database
SQL can retrieve data from a database
SQL can insert records in a database
SQL can update records in a database
SQL can delete records from a database
SQL can create new databases
SQL can create new tables in a database
SQL can create stored procedures in a database
SQL can create views in a database
SQL can set permissions on tables, procedures, and views
Back
What is the SELECT Statement for?
Front
The SELECT statement is used to select data from a database.
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
Can you have more than one statement to be executed in the same call to the server?
Front
Yes, but a semicolon is needed to separate each SQL Statement.
Back
What it the DELETE Statement used for?
Front
The DELETE statement is used to delete
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
Can SQL create views in a database?
Front
Yes, SQL can create views in a database
Back
What is a table?
Front
A table is a collection of related data entries and it consists of columns and rows.
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
Are SQL queries case sensitive?
Front
SQL keywords are NOT case sensitive
Back
What is the UPDATE Statement used for?
Front
The UPDATE statement is used to update existing records in a table.
Back
Example of OR operator
Front
Example of OR Syntax:
SELECT * FROM Customers
WHERE Country='Germany'
AND (City='Berlin' OR City='München');
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
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 is CRUD?
Front
Create, Read/Retrieve (Select), Update and Delete are the four basic functions of persistent storage.
Back
What is the Basis of SQL?
Front
RDBMS is the basis for SQL, and for all modern database systems such as MS SQL Server, IBM DB2, Oracle, MySQL, and Microsoft Access.
Back
DISTINCT syntax
Front
SELECT DISTINCT column_name,column_name
FROM table_name;
Back
What does the C in CRUD stand for?
Front
Create, C in CRUD, stand for Create and is on of the four basic functions of persistent storage.
Back
Why does the SELECT TOP clause be useful on large tables?
Front
Performance - Returning a large number of records can impact on performance.
Back
What happens if you use the UPDATE statement without the WHERE?
Front
All Records are updated.
Back
Can SQL create new tables in a database?
Front
Yes, SQL can create new tables in a database
Back
What is RDBMS?
Front
RDBMS stands for Relational Database Management System.
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
What is the function of the Semicolon in SQL?
Front
Semicolon is the standard way to separate each SQL statement in database systems that allow more than one SQL statement to be executed in the same call to the server.
Back
Is select is the same as SELECT in SQL?
Front
Yes, select is the same as SELECT since SQL is not case sensitive
Back
Can SQL delete records from a database?
Front
Yes, SQL can delete records from a database
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
Section 2
(50 cards)
What are SQL constraints used for?
Front
SQL constraints are used to specify rules for the data in a table.
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).
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
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
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 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
Example syntax of SELECT TOP
Front
SELECT TOP example syntax:
SELECT TOP number|percent column_name(s)
FROM table_name;
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 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
IN Clause
Front
The IN operator allows you to specify multiple values in a WHERE clause.
Back
Can you have a lot of UNIQUE Constraints per table?
Front
YES, that you can have many UNIQUE constraints per table, but only one PRIMARY KEY constraint per table.
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
When creating a table how are tables organized?
Front
Tables are organized into rows and columns; and each table must have a name.
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 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 is the LIKE Operator used for?
Front
The LIKE operator is used to search for a specified pattern in a column.
Back
Does the NOT NULL Constraint always needs to contain a value?
Front
Yes, The NOT NULL constraint enforces a field to always contain a value.
Back
Example of UNION syntax:
Front
Example of UNION syntax:
SELECT column_name(s) FROM table1
UNION
SELECT column_name(s) FROM table2;
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
What does the SELECT INTO do?
Front
The SELECT INTO statement selects data from one table and inserts it into a new table.
Back
Can SQL Constrains 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
Is the SELECT TOP supported by all database systems?
Front
No, Not all database systems support the SELECT TOP clause.
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 are the Aliases (AS) main purpose?
Front
Readability - Basically, aliases are created to make column names more readable.
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 JOIN clause used for?
Front
An SQL JOIN clause is used to combine rows from two or more tables, based on a common field between them.
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 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 NOT NULL Constraint do?
Front
The NOT NULL constraint enforces a column to NOT accept NULL values.
Back
What happens on a SQL constrain if there is a violation between the constrain and the data action?
Front
If there is any violation between the constraint and the data action, the action is aborted by the constraint.
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
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).
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
What is the CREATE TABLE statement used for?
Front
The CREATE TABLE statement is used to create a table in a database.
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 is the CREATE DATABASE statement used for?
Front
The CREATE DATABASE statement is used to create a database.
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 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 BETWEEN operator do?
Front
The BETWEEN operator selects values within a range.
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 does the UNIQUE Constraint do?
Front
The UNIQUE constraint uniquely identifies each record in a database table.
Back
In an INSERT INTO are all rows affected?
Front
No, Any existing rows in the target table are unaffected.
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
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 BETWEEN operator syntax:
Front
BETWEEN operator syntax:
SELECT column_name(s)
FROM table_name
WHERE column_name BETWEEN value1 AND value2;
Back
What does a UNIQUE Constraint provide?
Front
Uniqueness - The UNIQUE and PRIMARY KEY constraints both provide a guarantee for uniqueness for a column or set of columns.
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
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.
Back
Example of CREATE DATABASE syntax:
Front
Example of CREATE DATABASE syntax:
CREATE DATABASE dbname;
Auto-increment allows a unique number to be generated when a new record is inserted into a table.
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
How is the type TIMESTAMP in SQL structured?
Front
The type TIMESTAMP is formatted like: A Unique Number
Back
Data Type: Variable Character
Front
Character string. Variable length. Maximum length n
varchar(64)
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
What is a View?
Front
A view is a virtual table based on the result-set of an SQL statement
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
What does a VIEW contain?
Front
A view contains rows and columns, just like a real table.
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
Can a PRIMARY KEY contain NULL VALUES?
Front
No, A primary key column cannot contain NULL values.
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 DROP VIEW syntax:
Front
Example of DROP VIEW syntax:
DROP VIEW view_name
Back
What are the INDEXES used for?
Front
Indexes allow the database application to find data fast; without reading the whole table.
Back
How is the type DATE in SQL structured?
Front
The type DATE is formatted like: YYYY-MM-DD
Back
Example of CREATE INDEX syntax:
Front
Example of CREATE INDEX syntax:
CREATE INDEX index_name
ON table_name (column_name)
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
Should most tables contain a Primary Key?
Front
Yes, Most tables should have a primary key, and each table can have only ONE primary key.
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 are the FIELDS in a view?
Front
The fields in a view are fields from one or more real tables in the database.
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
What is the CREAT INDEX used for?
Front
The CREATE INDEX statement is used to create indexes in tables.
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 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
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
Data Type: Boolean
Front
Stores TRUE or FALSE values
boolean
Back
Do PRIMARY KEYS must contain UNIQUE values?
Front
Yes, Primary keys must contain UNIQUE values.
Back
Example of DROP Syntax:
Front
Example of DROP Syntax:
DROP INDEX table_name.index_name
DROP DATABASE database_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
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
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
Data Type: Integer
Front
Integer numerical (no decimal). Precision p
int
Back
What does the PRIMARY KEY do?
Front
The PRIMARY KEY constraint uniquely identifies each record in a database table.
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
Data Type: Character
Front
Character string. Fixed-length n
char(32)
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
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 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
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
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
How is the type DATETIME in SQL structured?
Front
The type DATETIME is formatted like: YYYY-MM-DD HH:MI:SS
Back
What is the DEFAULT Constraint used for?
Front
The DEFAULT constraint is used to insert a default value into a column.
Back
What is a FOREIGN KEY?
Front
A FOREIGN KEY in one table points to a PRIMARY KEY in another table.
Back
What do Null Values represent?
Front
NULL values represent missing unknown data. By default, a table column can hold NULL values
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 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
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
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
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
Section 4
(50 cards)
What does an Average Function return?
Front
The AVG() function returns the average value of a numeric column.
Back
Example of MAX Function Syntax:
Front
Example of MAX Function Syntax:
SELECT MAX(column_name) FROM table_name;
Back
What does a Count Function Return?
Front
The COUNT() function returns the number of rows that matches a specified criteria.
Back
Data Type: Date
Front
Stores year, month, and day values
date
Back
Example of a COUNT function syntax:
Front
Example of a COUNT function syntax:
SELECT COUNT(column_name) 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
SQL Functions
Front
SQL has many built-in functions for performing calculations on data. Aggregate functions and Scalar Functions.
Back
Example of Round Function Syntax:
Front
Example of Round Function Syntax:
SELECT ROUND(column_name,decimals) FROM table_name;
Back
Can you have multiple Schemas in a Database?
Front
Yes, You may have one or multiple schemas in a database.
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 Lower Case Function do?
Front
The LCASE() function converts the value of a field to lowercase.
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 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
Does a Schema has a limit to the number of objects it may contain?
Front
No, unless it's restricted by implementation, Schema does not have a limit to it's containing objects.
A schema can consist of a single table and has no limits to the number of objects that it may contain, unless restricted by a specific database implementation.
Back
Example of MIN function Syntax:
Front
Example of MIN function Syntax:
SELECT MIN(column_name) FROM table_name;
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
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
Example of Length syntax
Front
Example of Length syntax
SELECT LENGTH(column_name) FROM table_name;
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
What does the Upper Case Function do?
Front
The UCASE() function converts the value of a field to uppercase.
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
Data Type: Time
Front
Stores hour, minute, and second values
time
Back
Data Type: Timestampe
Front
Stores year, month, day, hour, minute, and second values
timestamp
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 Now Function Syntax
Front
Example of Now Function Syntax
SELECT NOW() FROM table_name;
Back
Example of First Function Syntax:
Front
Example of First Function Syntax:
SELECT FIRST(column_name) FROM table_name;
Back
What is the Length Function used for?
Front
The LEN() function returns the length of the value in a text field.
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
Example of mid Syntax:
Front
Example of mid Syntax:
SELECT MID(column_name,start,length) AS some_name FROM table_name;
Back
What does the Now Function return?
Front
The NOW() function returns the current system date and time.
Back
What is a Schema?
Front
A schema is a collection of database objects (tables) associated with one particular database username.
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
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 is the Round Function used for?
Front
The ROUND() function is used to round a numeric field to the number of decimals specified.
Back
What does the Last Function Return?
Front
The LAST() function returns the last value of the selected column. Only in MS Access
Back
What does the Max Function Return?
Front
The MAX() function returns the largest value of the selected column.
Back
Data Type: Aray
Front
A set-length and ordered collection of elements
Back
Example of LAST Function Syntax
Front
Example of LAST Function Syntax
SELECT LAST(column_name) FROM table_name;
Back
What does the Sum Function Return?
Front
The SUM() function returns the SUM of the values of the selected column.
Back
Example of UCASE Function Syntax:
Front
Example of UCASE Function Syntax:
SELECT UPPER(column_name) FROM table_name;
Back
What is a Subquery?
Front
A subquery is a SQL query nested inside a larger query.
Back
What is the Mid Function used for?
Front
The MID() function is used to extract characters from a text field.
Back
Example of LCASE syntax:
Front
Example of LCASE syntax:
SELECT LOWER(column_name) FROM table_name;
Back
What does the Min Function Return?
Front
The MIN() function returns the smallest value of the selected column.
Back
What is a Intersect?
Front
A Intersect is the Same as INNER JOIN
Back
Example of Sum Function Syntax:
Front
Example of Sum Function Syntax:
SELECT MIN(column_name) FROM table_name;
Back
What does the First Function Return?
Front
The FIRST() function returns the first value of the selected column. Only in MS Access
Back
Data Type: Real
Front
Approximate numerical, mantissa precision 7
real
Back
Example of an Average Function Syntax:
Front
Example of an Average Function Syntax:
SELECT AVG(column_name) FROM table_name
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.
Back
Section 5
(50 cards)
What is a Data type: varchar(size)
Front
Variable-length character string.
Max size is specified in parenthesis.
Back
What does the SIGN(x) return?
Front
Returns the sign of input x as -1,0,1
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
What is Data type: char(size)
Front
It's the Fixed-length character string.
Size specified in parentheses. 255
Back
What does the CEILING(x), CEIL(x) return?
Front
Returns the smallest integer value that is greater than or equal to x
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
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
What is a Data type: number(size)
Front
Number value with a max number of column digits specified in parenthesis.
Back
What does the POWER(x,y) return?
Front
Returns the value of x raised to the power of y
Back
What does the MIN Return?
Front
Returns the smallest value in a given column
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
Example of a SELECT statement syntax
Front
Example of a SELECT statement syntax
select "column1" [,"column2",etc]
from "tablename" [where "condition"];
[] = optional
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
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 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
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 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
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
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 the DELETE statement used for?
Front
The DELETE statement is used to delete records or rows from the 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
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
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
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
What does the ABS(x) return?
Front
Returns the absolute value of x
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
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
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 does the FLOOR(x) return?
Front
Returns the largest integer value that is less than or equal to x
Back
What does the MAX Return?
Front
Returns the largest value in a given column
Back
What does the MOD(x,y) return?
Front
Modulo- returns the integer remainder of x divided by y (same as x%y)
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
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
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
What does the ROUND(x) return?
Front
Returns the value of x rounded to the nearest whole integer
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
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 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 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
COUNT- Aggregate fxn
Front
Returns the total number of values in a given column
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
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
What is the SELECT Statement (def, partial) used for?
Front
The SELECT statement is used to query the database and retrieve.
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
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
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
COUNT(*) - Aggregate fxn
Front
Returns the number of rows in a table
Back
What does UNION do?
Front
UNION merges the contents of two structurally-compatible tables into a single combined table.
Back
Is a RIGHT JOIN the same as RIGHT OUTER JOIN?
Front
Yes, A RIGHT JOIN is the same as RIGHT OUTER JOIN
Back
Section 6
(3 cards)
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
What does the SQRT(x) return?
Front
Returns the square-root value of x
Back
Example of TABLE JOIN syntax
Front
SELECT "list-of-columns"
FROM table1,table2
WHERE "search-condition(s)"