Unit 9 : SQL ( Part 1 ) Flashcards
List out 2 broad categories of SQL Functions
- Data Definition Language ( DDL )
- Create Database, Tables, Indexs and Views
- Define access rights to those database objects
- Data Manipulation Language ( DML )
- Commands to insert, update, delete and retireve data within database tables
How many words does basic command set has ?
- Less than 100 words
Who prescribes a standard SQL?
- American National Standards Institute ( ANSI )
Will there be several SQL dialects exists ?
- Yes
List out 2 tasks must be completed before creating a database?
- Create database structure
- Create tables that will hold end-user data
- RDBMS creates physical files that will hold database
- RDBMS tends to differ from one to another
What is schema?
- Group of database objects , such as tables and indexes that are related to each other
How does Authentication process through DBMS? ( 2 )
- Verifies taht only registered users are able to access database
- Log on to RDBMS using user id and password created by database administrator
What is data type selection is usually dictated by ?
- Nature of data and by intended use
- Need to pay close attention to expected use of attributes for sorting and data retrieval purposes
What uses DECIMAL (L,D) for data types?
- Price
What use INTEGER for data types?
- Whole numbers
List out 2 data types for Character
- CHAR(L)
- VARCHAR(L) or VARCHAR2(L)
- Oracle users may use VARCHAR2 as well as VARCHAR
List out 4 data types for Character
- NUMBER(L,D)
- INTEGER
- SMALLINT
- DECIMAL(L,D)
List out data types for date
- DATE
What specification does Primary Key contains ? ( 2 )
- NOT NULL
- UNIQUE
What will RDBMS do after creating Primary Key?
- Automatically enforce referential integrity for foreign keys
What symbol should we use when the command sequence ends?
- Semicolon ( ; )
What does NOT NULL constraint ensures?
- Ensures that column does not accept nulls
What does UNIQUE constraint ensures?
- Ensures that all values in column are unique
What does DEFAULT constraint assigns?
- Assigns value to attribute when a new row is added to table
What does CHECK constraint validates
- Validates data when attribute value is entered
List out the commands with Data Manipulation ( 7 )
- Adding table rows
- Saving table changes
- Listing table rows
- Updating table rows
- Restoring table contents
- Deleting table rows
- Inserting table rows with a select subquery
How to insert values ? ( Syntax )
INSERT INTO columnname
VALUES ( value1 , value2 , … , valuen )
When should we use NULL?
- NULL for unknown values
List out 3 things that lets database save physically on disk
- Database is closed
- Program is closed
- COMMIT command is used
COMMIT [WORK]; ( Syntax )
* It will permanently save any changes made to any table in the database