Databases Flashcards
What is SQL
Structured Query Language
CREATE
Used to create a new table (or database)
What is a database?
Is a persistent collection of related data stored in a structured way
What are the 3 characteristics of a data base
-There are tools to query (search, sort, filter) data.
-Databases are made up of entities (Tables)
-Each able contains fields and records.
What is a flat database
Stores all data in one table / entity
What are the pros and cons of a flat file database
+Use database tools to filter / sort
-we might encounter data integrity issues (when you cant trust your data)
-This could happen as you store something in different ways more then once (when you store things more then once its called data redundancy)
-data redundancy might lead a larger database then necessary
What is a secondary key?
A field that is an alternative Primary Key (also unique)
What is a primary Key
A field that uniquely identifies a record
What is a foreign key?
A primary key from another table, used to maintain a relationship
What is data integrity?
When you can’t trust your data, there could be inconsistencies (tends to happen when there is redundant data)
What is data redundancy?
When we stored duplicate data
What are the types of relationships in an ER diagram
-One to one
-many to one
-many to many
How do you delete a table or database
DROP
(DROP TABLE testTable;)
How do you add a new record to a table?
INSERT
INSERT INTO testTable (custID, first_name)
VALUES (1, “tim”);
How do you add a new record to a table?
INSERT
INSERT INTO testTable (custID, first_name)
VALUES (1, “tim”);