Databases / SQL Flashcards
What is the SQL Command for Selecting / Querying Data?
SELECT Email
FROM Customer
WHERE CustomerID = 1;
What is the SQL command for inserting data?
INSERT INTO Customer (FirstName, LastName, Email)
VALUES (“John”, “Smith”, “JSmith@gmail.com”);
What is the SQL command for deleting data?
DELETE FROM Customer
WHERE CustomerID = 1;
What is the SQL Command for updating existing data?
UPDATE Customer SET Email (JSmith@gmail.com)
What is the SQL Command for creating a table?
CREATE TABLE Customer ( CustomerID int, LastName varchar, FirstName varchar, Email varchar );
What is a Primary Key in a Database?
It is a unique identifier that is unique to a certain piece of data so it can be used in queries or used to link to other tables so data isn’t repeated in the database.
What is a Foreign Key in a Database?
It is a reference to a primary key within another table so that that particular table can link to the data of another table.
What is an ERD?
it is an Entity Relationship Diagram and is a visual representation of the relationships between the tables with the use of primary and foreign keys.
What is UNF?
Where there is no Normalisation done on the database
What is 1NF?
This is where, repeating data in rows (records) and columns is removed, data is made atomic and each row is assigned a unique identifier and each field has a unique name.
What is 2NF?
This is where redundant data is removed, as it may not rely on other factors within the database, as a result It won’t be necessary.
If data is still important but doesn’t directly relate to the current table it can be turned into another table that links to the older one.
What is 3NF?
This is further analysis of redundant data that could be removed from the database, some examples can be having a field that details the city and another that details the country. There is no need for the country field as you can figure it out with common knowledge of the city.
What does ACID stand for?
Atomicity
Consistency
Isolation
Durability
What is Atomicity in ACID?
All or Nothing, where the transaction has been completed in full or not at all.
What is Consistency in ACID?
This is where can transaction always returns a consistent state without any issues. All rules are intact after the transaction.