SQL Flashcards
What are some differences between SQL and NoSQL?
NoSQL(document-oriented storage) stores data in graphs, kv pairs, or documents (similar to JSON). Documents are stored in collections that are similar to SQL’s tables to hold related entries. No schema or restrictions to particular columns or fields.
What is normalization?
A technique of not storing duplicate information but instead storing a reference to it, like SQL storing photos in a separate table
What is denormalization?
NoSQL where a single query can retrieve all the information we need however data is duplicated so if we want to update we need to change the same thing in multiple places
What is a transaction?
- A unit of work performed against a database. All work in the transaction must succeed or it’s rolled back. “All or nothing”
- We can trust our data is consistent across tables because operations are in a transaction
What is a RDBMS?
Relational database management system (Oracle)
What is a schema?
The description of the organization of a database table, columns, and data types
What is the difference between static typing and dynamic typing?
Static requires you to specify the type of data upfront
List some common SQL datatypes
- Boolean
- INT
- FLOAT
- VARCHAR (255)
- TEXT (unlimited length)
- DATE
- DATETIME
- TIME
- BLOB (binary data; eg an image)
What is a foreign key?
A value in a database table whose responsibility is to point to a row in a different table.
What does SQL stand for?
Structured query language. It’s a domain-specific language to query data out of relational databases.
What are the comparision and equality operators in SQL?
(, >=, <=, =, !=)
What are the boolean operators in SQL?
(AND, OR, NOT)
Provide an example of a SQL Select
SELECT * FROM users WHERE name = 'Ned';
Provide an example of a SQL Insert
INSERT INTO
users (name, age, height_in_inches)
VALUES
(‘Santa Claus’, 876, 34);
Provide an example of a SQL Update
UPDATE users SET name = 'Eddard Stark', house = 'Winterfell' WHERE name = 'Ned Stark';