Basic Flashcards
(92 cards)
What is SQL?
Structured Query Language - programming language for managing data. Performs tasks such as retrieval, updation, insertion and deletion of data from a database.
What is DBMS?
Data Base Management System - allows for the creation, maintenance, and use of a database. “File Manager “ that manages data
What is RDBMS? What is NRDBMS?
Relational Data Base Management System - stores data in tables and can manipulate it. Examples : MySQL, SQL Server, Oracle
Non-relational database management system a database that does not use the tabular schema of rows and columns found in most traditional database systems; uses a storage model that is optimized for the specific requirements of the type of data being stored
What is a database?
An organized collection and storage of data
What are tables? What are fields?
Tables = data organized in columns and rows and the ROWS ( records), COLUMNS (fields)
What is a primary key?
A unique identifier for each record. Ex: VIN, DL #, Phone # - NO DUPLICATE , NO NULL accepted
What is a unique key?
A unique constraint that is a group of one or more than one fields or columns that identify a database or record
What is a null value?
A data value that does not exist in database
What is a foreign key?
A column or group of columns in a table that provides link between data in 2 tables - related to primary key of another table
What is a join?
A clause/ keyword used to combine rows in 2 or more tables
What are the types of join? Explain each
a. Inner Join =return matching rows in both tables
b. Right join =return all rows in right table - even if no matches in left table
c. Left join = return all rows in left table - even if no matches in right table
d. Full join = return rows when one table has match
e. Self join = joins table to itself
f. Cartesian join (Cross join) = returns products of sets of records of 2 or more joined tables
What is normalization? What are the advanatages?
Database technique of reducing the data redundancy and dependency by organizing fields and tables in database - add, delete, modify fields that can be in 1 single table
Better Database organization More Tables with smaller rows Efficient data access Greater Flexibility for Queries Quickly find the information Easier to implement Security Allows easy modification Reduction of redundant and duplicate data More Compact Database Ensure Consistent data after modification
What is denormalization?
Database technique of adding the data redundant data and dependency in database
What are all the different normalizations?
a. First normal form (1NF) = cant have multiple values - should be atomic (cant be divided) values
b. Second normal form (2NF) =1NF + dependencies removed and placed in seperate table
c. Third normal form (3NF) = 2NF + should have no Transitive dependency ( an indirect relationship between values in same table)
d. “Boyce Codd Normal Form” =
e. Fourth normal form ( 4NF) = 3NF + should not have 2 or more independent Multivalued dependency (when 2 or more attributes in table are independent of each other but depend on 3rd attribute )
f. Fifth normal form ( 5NF) = 4NF + cant be broken down into smaller tables without data loss
g. Sixth normal form (6NF) = has not been determined yet!
What is a view? What are views used for?
A virtual table with rows and columns used for data security ( the enclose table name) and analysis
- Restricting access to data.
- Making complex queries simple.
- Ensuring data independence.
- Providing different views of same data.
What is an index?
Tuning method to allow faster retrieval of records from table
What are the types of indexes?
a. Unique = Index key column doesn’t have duplicate values if column is unique
b. Clustered = Reorders the physical order of the table and search based on the key values; for “easy retrieval of data”; sorts out rows by column
c. Non-clustered = Does not alter the physical order of the table and maintains logical order of data; stored at one place and table data is stored in another place
What is a cursor?
A control/ pointer that allows you to travel over rows and columns
What is a relationship? What are the types?
What is an entity?
Established relationships between 2 or more tables - involves common fields in 2 or more tables
a. One - One (1:1) = 1 record in table associated with ONLY one record in another table
b. One - Many (1:N) = 1 record in table associated with one or more records in another table
c. Many - Many (M:N) = many records in table associated with many records in another table
A person, place, or thing in the real world about which data can be stored in a database
What is a query?
A code written in order to get the information back from the database
What is a subquery? What are the types of subquery?
A query inside another query - outer query (main query ) + inner query (sub-query) ; subquery first and then result passed to main query
a. Correlated =inner query dependent on values of outer query for its values
b. Non- correlated =inner query isnt dependent on values of outer query for its values; stands alone
What is a stored procedure?
A function that consists of many SQL statements to access the database system.
What is a trigger? What are nested triggers?
A code or programs that automatically execute with response to event on a table or view in a database
Execute after a DML or DDL operation is performed
What is difference between TRUNCATE, DROP, and DELETE?
Truncate = delete data rows in tables but not table itself ; cant be rolled back
Delete = removes specific records from table
Drop = removes table from database, cant be rolled back