SQl 2
Terms
undefined, object
copy deck
- What statement is used to query the database and retrieve selected data that match the criteria that you specify?
- Select
- When matching strings with Like the comparision values must be show how?
- Strings must be in single quotes.
- What are the rules for table names?
- They must start with a letter and can be followed by letters, numbers, or underscores - not to exceed a total of 30 characters in length. Do not use any SQL reserved keywords as names for tables or column names (such as "select", "create", "insert", etc).
- Data type holds number value with a max number of column digits specified in parenthesis.
- number(size)
- What is a "unique" constraint"?
- It specifies that no two records can have the same value in a particular column.
- What is the syntax for the insert statement?
-
insert into "tablename"
(first_column,...last_column)
values (first_value,...last_value); - The table name that follows the _____ keyword from specifies the table that will be queried to retrieve the desired results.
- from
- To make a new table what SQl statment is used?
- create table
- Name all SQL data types.
-
char(size)
varchar(size)
number(size)
date(size)
number(size,d) - Data type holds a date value.
- date
- The two most popular constraints are what?
- not null" which specifies that a column can't be left blank, and "primary key". A "primary key" constraint defines a unique identification of each record (or row) in a table.
- The _____ clause (optional) specifies which data values or rows will be returned or displayed, based on the criteria described after the keyword.
- where
- The ____ pattern matching operator can also be used in the conditional selection of the where clause. It is a very powerful operator that allows you to select only rows that are the same as what you specify.
- Like
- What is the syntax of the Create Table statement?
-
create table "tablename"
("column1" "data type",
"column2" "data type",
"column3" "data type"); - Variable type holds fixed-length character string. Size is specified in parenthesis. Max 255 bytes.
- char(size)
- Data type holds number value with a maximum number of digits of "size" total, with a maximum number of "d" digits to the right of the decimal.
- number(size,d
- The ____ statement is used to insert or add a row of data into the table.
- insert
- When inserting new records into the database what are the rules for how the actual values to be inserted to should handled?
- Strings should be enclosed in single quotes, and numbers should not.
- What are the conditional selections used in the where clause
-
= Equal
> Greater than
< Less than
>= Greater than or equal
<= Less than or equal
<> Not equal to
LIKE - The ____ can be used as a wild card to match any possible character that might appear before or after the characters specified.
- percent sign "%"
- What are optional in the Create Table statement?
- constraints
- Data type holds variable-length character string. Max size is specified in parenthesis.
- varchar(size)
- What are constraints?
- When tables are created, it is common for one or more columns to have ___ associated with them. A _____is basically a rule associated with a column that the data entered into that column must follow.
- To insert records into a table, enter the key words ____ followed by the table name.
- insert into
- The ___ statement is used to update or change records that match a specified criteria. This is accomplished by carefully constructing a where clause.
- update
- What is the syntax for the Update statement?
-
update "tablename"
set "columnname" =
"newvalue"
[,"nextcolumn" =
"newvalue2"...]
where "columnname"
OPERATOR "value"
[and|or "column"
OPERATOR "value"];
[] = optional