Section 1

Preview this deck

How to tell number of characters placed to the left of the decimal?

Front

Star 0%
Star 0%
Star 0%
Star 0%
Star 0%

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Active users

0

All-time users

0

Favorites

0

Last updated

6 years ago

Date created

Mar 1, 2020

Cards (68)

Section 1

(50 cards)

How to tell number of characters placed to the left of the decimal?

Front

use p-s formula (9,2) is 7 characters before decimal

Back

DATA TYPE alternate that only stores actual number of characters inserted into table

Front

VARCHAR(n)

Back

When do you need to use the SELECT FROM WHERE clause?

Front

When you have put restrictions on what the select results will display

Back

DATA TYPE that Store characters and special chars using all space in column

Front

CHAR(n)

Back

Is the BETWEEN inclusive or not?

Front

The BETWEEN operator is inclusive so the query will select value equal to either value in the query and in the range.

Back

DELETE TABLE

Front

DROP TABLE [TABLE_NAME];

Back

How do you find a result that is between two values?

Front

use the SELECT FROM WHERE with AND SELECT [COLUMN_NAME] FROM [TABLE _NAME] WHERE [COLUMN_NAME] = [COMPARISON OPERATOR] AND [COMPARISON OPERATOR]; SELECT CUSTOMER_NUM, BALANCE FROM CUSTOMER WHERE BALANCE >= 2000 AND BALANCE <=5200; OR USE THE BETWEEN OPERATOR with AND SELECT [COLUMN_NAME] FROM [TABLE _NAME] WHERE [COLUMN_NAME] BETWEEN [WHAT] and [WHAT]; SELECT CUSTOMER_NUM, BALANE FROM CUSTOMER WHERE BALANCE BETWEEN 2000 AND 5000

Back

How to find a column one or more specific values

Front

Use the IN clause SELECT COLUMN_NAME FROM [TABLE] WHERE [COLUMN_NAME] IN (value, value, etc,); SELECT CUSTOMER_NUM, CUSTOMER_NAME, CREDIT_LIMIT FROM CUSTOMER WHERE CREDIT_LIMIT IN (5000, 10000, 15000)

Back

How do you find a result when you need no stated result to be found (everything except)?

Front

Use the WHERE NOT condition SELECT [COLUMN_NAME] FROM [TABLE _NAME] WHERE NOT [COLUMN_NAME] = [?]

Back

What command do you use to insert values into a table row?

Front

INSERT INTO [TABLE_NAME] VALUES (place the values here in the order of the columns) Note that CHAR column entries must be enclosed in single quote marks All entries should be entered as you want to search and find them later and appear because the entries inside the tables are case sensitive

Back

Which data type uses integers and no decimals but also uses less space than INT DATA TYPE?

Front

SMALL INT

Back

DATA TYPE for decimal type numbers

Front

DECIMAL [p,s]

Back

Find the number, name and available credit for each customer with at least $5,000 of available credit

Front

SELECT CUSTOMER_NUM CUSTOMER_NAME, CREDIT LIMIT - BALANCE AS AVAILABLE_CREDIT FROM CUSTOMER WHERE CREDIT_LIMIT - BALANCE => 5000;

Back

How do you find a result when you need either or to be found

Front

SELECT [COLUMN_NAME] FROM [TABLE_NAME] WHERE [COLUMN_NAME] [COMPARISON OPERATOR] [?] OR [COLUMN_NAME] [COMPARISON OPERATOR] [?] SELECT DESCRIPTION FROM ITEM WHERE STOREHOUSE = '3' OR ON_HAND > 25;

Back

How do you form a Compound Condition?

Front

You form a compound condition by connecting two or more simple conditions with AND, OR, and NOT operators

Back

Display a table structure

Front

DESCRIBE [TABLE_NAME];

Back

How do you specify a dollar value if SQL

Front

In SQL, numbers included in queries are entered without extra symbols such as dollar signs and commas.

Back

What is the equal to comparison operator?

Front

=

Back

TABLE NAMING RULES

Front

1. NAME CANNOT BE MORE THAN 30 CHARS 2. MUST START WITH A LETTER 3. CAN CONTAIN LETTERS, NUMBERS AND UNDERSCORES 4. CANNOT CONTAIN SPACES

Back

DATA TYPE for dates

Front

DATE [Uses format DD-MM-YYYY]

Back

What is the NOT EQUAL TO comparison operator?

Front

<>

Back

What is the LESS THAN comparison operator?

Front

<

Back

When do you enclose a value you are searching for in quotation marks?

Front

When the text you are searching for is inside a CHAR COLUMN

Back

What is the GREATER THAN or EQUAL TO comparison operator?

Front

>=

Back

What is the LESS THAN or EQUAL TO comparison operator?

Front

<=

Back

What wild card symbol can be used to represent any individual character

Front

the underscore (_) symbol Example SELECT CUSTOMER_NUM FROM CUSTOMER WHERE CUSTOMER_NUM LIKE (7_1);

Back

SELECT EVERY COLUMN AND ROW IN TABL

Front

SELECT * FROM [TABLE_NAME];

Back

How do you delete a specific row from a table?

Front

DELETE FROM [TABLE_NAME] WHERE [PRIMARY KEY COLUMN NAME] = [?];

Back

Which DATA TYPE will produce numbers in sequence automatically if used with AUTO_INCREMENT?

Front

INT AUTO_INCREMENT (Useful for primary key columns)

Back

SELECT CLAUSE

Front

SELECT CLAUSE FOLLOWED BY THE LIST OF COLUMNS, SEPARATED BY COMMAS. THEN FROM AND TABLE NAME

Back

Find the name of the customers located in the city of Grove from the CUSTOMER table?

Front

SELECT CUSTOMER_NAME FROM CUSTOMER WHERE CITY = 'Grove';

Back

How do you subtract two columns in the result

Front

Use the - operator SELECT CUSTOMER_NUM, CUSTOMER_NAME, [CREDIT_LIMIT - BALANCE] FROM CUSTOMER

Back

How do you update a specific cell in a table? / What is the format for using the UPDATE command?

Front

1. Find the primary key entry value for the row to be changed. UPDATE (TABLE_NAME) SET (COLUMN_NAME) = <NEW VALUE> IF NECESSARY, where necessary include the where clause to indicate in which the change is to take place WHERE (PRIMARY_KEY_COLUMN) = <value.

Back

How do you divide two columns in the result

Front

Use the / operator SELECT CUSTOMER_NUM, ITEM, [EXTENDED_PRICE / QTY] AS NET_PRICE FROM CUSTOMER

Back

WHAT operator will work together with WITH to find items similar or matching a pattern?

Front

SELECT FROM WHERE [COLUMN_NAME] LIKE '%?%';

Back

DISTINCT OPERATOR

Front

Prevents duplicates This will prevent the results from showing multiple rows in a table for the same value requested SELECT DISTINCT(COLUMN_NAME) FROM [TABLE_NAME];

Back

How do you add two columns in the result

Front

Use the + operator SELECT CUSTOMER_NUM, CUSTOMER_NAME, [CREDIT_LIMIT + BALANCE] FROM CUSTOMER

Back

Find the name, balance and credit limit for all customers with balances greater than their credit limit CREDIT_LIMIT, BALANCE, CUSTOMER_NAME

Front

SELECT CUSTOMER_NAME, BALANCE, CREDIT_LIMIT FROM CUSTOMER WHERE BALANCE > CREDIT_LIMIT;

Back

CREATING A TABLE COMMAND

Front

CREATE TABLE [TABLE_NAME] (COLUMN_NAME [DATATYPE](WIDTH) PRIMARY KEY, ETC.... );

Back

DATA TYPE that is numeric but has no decimals

Front

INT

Back

How do you add data into a table into specific desired columns only?

Front

Use INSERT INTO [TABLE_NAME] ([COLUMN_NAME], [COLUMN, NAME], [etc.]) VALUES (name the values that you want inserted into those columns in the order specified)

Back

When you use the AND compound what must be true?

Front

All the simple conditions must be true WHERE [COLUMN_NAME] = '3' AND [COLUMN_NAME] > 25;

Back

When you need to retrieve rows to satisfy a restriction condition, how do you?

Front

SELECT [COLUMN NAMES] [etc.] FROM [TABLE_NAME]; WHERE [COLUMN_NAME] = [?]?

Back

What is the GREATER THAN comparison operator?

Front

>

Back

How to select all items from specific columns

Front

SELECT [COLUMN NAMES] [etc.] FROM [TABLE_NAME];

Back

HOW TO SPECIFY IF TABLE COLUMN CAN'T BE NULL

Front

TYPE (WITHOUT QUOTES) "NOT NULL" BEFORE COMMA

Back

How do you multiply two columns in the result

Front

Use the * operator SELECT CUSTOMER_NUM, CUSTOMER_NAME, [CREDIT_LIMIT * BALANCE] AS NET_VALUE FROM CUSTOMER

Back

SELECT A COMPUTED COLUMN [CALCULATE TWO COLUMNS]

Front

SELECT COLUMN NAMES (COLUMN [+ - * OR /] COLUMN) AS [COLUMN_NAME] FROM [TABLE_NAME];

Back

How do you assign a name to a computed column

Front

Specify the computation then add AS [COLUMN_TITLE]

Back

How do you indicate by default that a table can accept NULL values when creating a table?

Front

Don't type NOT NULL before the comma

Back

Section 2

(18 cards)

What does the DISTINCT function do?

Front

It, especially when used with the COUNT function, eliminates duplicate values in query results.

Back

What must you do to calculate a total?

Front

You can use the SUM[COLUMN_NAME] function, but the column must be numeric.

Back

What does the COUNT function do?

Front

Counts the number or rows in a table result from the column you choose. If it does not matter the column you can use the function COUNT(*)

Back

What does the MAX function do?

Front

The MAX function finds the maximum value in a numeric range

Back

What does the AVG function do?

Front

this function provides the average value in a numeric range

Back

When you sort by two columns, which is the major sort key and which is the minor sort key

Front

the first ORDER BY column is the major / primary sort key the second ORDER BY column is the minor / secondary sort key

Back

How do you ORDER BY in descending order?

Front

SELECT FROM ORDER BY [COLUMN_NAME] DESC;

Back

When are you able to use the 5 aggregate functions?

Front

Aggregate functions only apply to groups of rows. But, you do not have to use it with the group function. As long as you have multiple rows to apply it to, you can use it. SELECT COUNT (*) FROM ITEM WHERE CATEGORY = 'GME'; SELECT COUNT(*) SUM(BALANCE) FROM CUSTOMER;

Back

When you have two columns to be ORDER BY, when is the second column used by the DB?

Front

When the first column (major sort key) finds two equal values for a column, it moves to the next column to identify which to list and then how (ascending / descending) based on what you specify.

Back

How do you write a basic DISTINCT query?

Front

SELECT DISTINCT [COLUMN] FROM [TABLE]

Back

How do you count the number of rows in a column with a restriction?

Front

Specify the particular column / (s) instead of using as WHERE [COLUMN] = '[?]' SELECT COUNT (*) FROM ITEM WHERE CATEGORY = 'GME';

Back

What does the MIN function do?

Front

The MIN function finds the minimum value in a numeric range

Back

in the ORDER BY clause, how do you specify the order of multiple columns to be sorted by order?

Front

List the columns (keys) in order of importance

Back

Is a column sorted by default in ascending or descending order?

Front

by default a column is sorted by in ascending order

Back

How do you have the DB return results in a specific order

Front

Use the ORDER BY CLAUSE to list the data in a specific order SELECT [COLUMN_NAME(S)] FROM [TABLE_NAME] ORDER BY COLUMN_NAME

Back

What are the 5 aggregate functions?

Front

Average - (AVG) Count - (COUNT) Max - (MAX) Min - (MIN) Sum - (SUM)

Back

Does the aggregate functions consider or ignore NULLS

Front

the aggregate functions when used do pay attention to null values in the column and actually eliminate them from the computations.

Back

How do you use the DISTINCT or COUNT function to ensure you have accurately identified the correct number of unique instances?

Front

Use the function on a primary key where no duplicates are allowed.

Back