Send a link to your students to track their progress
76 Terms
1
New cards
database table
a database object, stores data for the database, consists of columns and rows, created and modified through data definition language (DDL) commands
2
New cards
Table and column names
can contain a maximum of 30 characters, no blank spaces, must begin with a letter, can contain numbers/underscore/number sign, must be unique, no reserved words are allowed
3
New cards
Data types
VARCHAR2, CHAR, NUMBER, DATE
4
New cards
defining columns
column definition list must be enclosed in parenthesis, datatype must be specified for each column, maximum of 1000 columns
5
New cards
data dictionary
typical component of a DBMS that maintains information about database objects, can query to verify all the tables that exist in your schema
6
New cards
USER_TABLES
data dictionary object that maintains information regarding all your tables
7
New cards
DESCRIBE
displays the structure of a specified table
8
New cards
modifying tables
accomplished through the ALTER TABLE command, use an ADD clause to add a column, use a MODIFY clause to change a column, use a DROP COLUMN to drop a column
9
New cards
modification guidelines
columns must be as wide as the data it already contains, if a NUMBER column already contains data size cannot be decreased, adding or changing default data does not affect existing data
10
New cards
ALTER TABLE and DROP command
can only reference one column per execution, deletion is permanent, cannot delete last remaining column in a table
11
New cards
RENAME TO
used to rename a table, the old name is no longer valid
12
New cards
TRUNCATE TABLE
command that deletes rows, structure of table remains
13
New cards
DROP TABLE
command that deletes table structure and contents
14
New cards
constraints
rules used to enforce business rules, practices, and policies; rules used to ensure accuracy and integrity of data
15
New cards
constraint types
PRIMARY KEY, FOREIGN KEY, UNIQUE, CHECK, NOT NULL
16
New cards
creating constraints
when: during table creation, after table creation by modifying existing table
how: column level approach, table level approach
17
New cards
creating constraints column level approach
the constraint applies to the column specified
18
New cards
creating constraints table level approach
approach that cannot be used to create any constraint type except NOT NULL, required if constraint is based on multiple columns
19
New cards
enforcement of constraints
all constraints are enforced at the table level, if a data value violates a constraint the entire row is rejected
20
New cards
adding constraints to existing tables
constraints added with the ALTER TABLE command, add a NOT NULL constraint using the MODIFY clause, all other constraints added using ADD clause
21
New cards
PRIMARY KEY constraint
ensures that columns do not contain duplicate or NULL values, only one per table is allowed
22
New cards
FOREIGN KEY constraint
requires a value to exist in the referenced column of another table, NULL values are allowed, enforces referential integrity, maps to the primary key in the parent table
23
New cards
UNIQUE constraint
no duplicates are allowed in the referenced column, NULL values are permitted
24
New cards
CHECK constraint
updates and additions must meet specified condition
25
New cards
NOT NULL constraint
a special CHECK constraint, can only be created at column level, included in output of DESCRIBE command, can only be added to an existing table using ALTER TABLE MODIFY command
26
New cards
USER_CONSTRAINTS
displays constraint listing for a specific table
27
New cards
INSERT command
command used to add rows to existing tables; identify table in the insert into clause, specify the data in the values clause, can only add one row at a time to a table, enclose nonnumeric data in single quotes
28
New cards
inserting NULL value
omit column name from insert into clause column list, substitute two single quotation marks, use NULL keyword
29
New cards
ON NULL clause
option with a default setting for empty values
30
New cards
constraint violations
when you add or modify table data, the data is checked for compliance with any applicable constraints
31
New cards
activating the default option
include a column list in the INSERT statement ignoring the column to use the default option; use the default keyword as the value for the column
32
New cards
subquery
when inserting data from an existing table into a different table, the section that uses SELECT and FROM
33
New cards
UPDATE command
modify existing rows; can add values to an existing row by replacing null values or change existing values; SET clause identifies columns being changed and new values
34
New cards
substitution variables
prompts user for a value; identified by ampersand & preceding variable name, can be used to create interactive scripts;
UPDATE customers
SET region = ‘&Region’
WHERE state = ‘&State’;
35
New cards
DELETE command
command that removes a row from a table; omitting the WHERE clause removes all the rows;
DELETE FROM
WHERE;
36
New cards
transaction control statements
results of data manipulation language (DML) are not permanently updated to a table until explicit or implicit COMMIT occurs; these statements can commit data through COMMIT command, undo data changes through ROLLBACK command
37
New cards
COMMIT command
explicit commit occurs by executing commit; implicit commit occurs when DDL command is executed or user properly exits system; permanently updates tables and allows other users to view changes
38
New cards
WHERE clause
clause used to retrieve rows based on a stated condition; requires column name, comparison operator, value or column for comparison; values are case sensitive; enclose nonnumeric data in single quotes
39
New cards
comparison operators
operators that indicate how the data should relate to the given search value; =, >,
40
New cards
BETWEEN AND operator
finds values in a specified range
41
New cards
IN operator
operator that returns records that match a value in a specified list; list must be in parentheses, values separated by commas
42
New cards
LIKE operator
operator that performs pattern searches, used with wildcard characters; underscore _ for exactly one character in the indicated position; percent sign % represents any number of characters
43
New cards
logical operators
operators used to combine conditions; NOT, AND, OR
44
New cards
multiple logical operator order
resolved in order of NOT, AND, OR; use parenthesis to override the order of evaluation
operator to show absence of data; cannot use = NULL since it will not return any rows
47
New cards
ORDER BY clause
clause that presents data in sorted order; ascending order is default, use DESC keyword to override column default; 255 columns maximum
48
New cards
ORDER BY clause sort sequence
in ascending order, values will be listed in following sequence: numeric values, character values, NULL values; the opposite in descending order
49
New cards
join
used to link tables and reconstruct data in a relational database; can be created through conditions in a WHERE clause or use of JOIN keywords in FROM clause
50
New cards
equality join
links rows through equivalent data that exists in both tables; created with equivalency condition in WHERE clause or NATURAL JOIN…USING or JOIN…ON in FROM clause
51
New cards
n-1
The number of join conditions is determined by the number of tables minus one
52
New cards
JOIN…USING
use this when tables have one or more columns in common
53
New cards
JOIN…ON
use when same named columns are not involved, or a condition is needed to specify a relationship other than equivalency
54
New cards
JOIN
use in order to free the WHERE clause for exclusive use in restricting rows
55
New cards
non-equality join
in WHERE clause use any comparison operator other than the equal sign, in FROM clause use JOIN…ON keywords
56
New cards
self-join
used to link a table to itself; requires the use of table aliases, requires the use of column qualifier
57
New cards
outer join
use to include rows that do not have a match in the other table; in WHERE clause, include this operator (+) immediately after the column name of the table with the missing rows to add NULL rows
58
New cards
59
New cards
set operators
UNION, UNION ALL, INTERSECT, MINUS
60
New cards
UNION
returns the results of both queries and removes duplicates
61
New cards
UNION ALL
returns results of both queries but includes duplicates
62
New cards
INTERSECT
returns only the rows included in the results of both queries
63
New cards
MINUS
subtracts the second query’s results if they are also returned in the first query’s result
64
New cards
function
predefined block of code that accepts arguments
65
New cards
single-row function
returns one row of results for each record processed
66
New cards
multiple-row function
returns one result per group of data processed
67
New cards
case conversion funcitons
UPPER, LOWER, INITCAP; functions that alter the case of data stored in a column or character string
68
New cards
character manipulation functions
SUBSTR, INSTR, LENGTH, LPAD, RPAD, LTRIM, RTRIM, REPLACE, TRANSLATE, CONCAT; manipulate data by extracting substrings, counting number of characters, replacing strings, etc