SQL Flashcards
What is the one thing that SQL is trying to do well as a language?
Managing data.
Describe statements to create a table, insert into it, and then select from it.
“<img></img>”
A table can’t have that many columns
No - it can have so many, dude. Like, 2,000 just in SQLite, more elsewhere.
Which SQL statements don’t return anything?
Create, Insert, Delete, Alter, Begin
SQL statements ignore case?
Yeah. They do.
Table and column names ignore case.
Yeah, but like, there are conventions for how to make them easy to distinguish.
What are the conventions to distinguish SQL keywords from table and column names?
SQL KEYWORDS SHOUT THEIR NAME while table_and_column_names_use_lowercase_snake
SQL gives mad respect to case within strings?
Yeah. Mad respect. ‘a’ does not equal ‘A’ in a string.
What happens if you insert into a non-existant column. You know what, while we’re at it, what happens with ANY operation on a non-existant column.
ERROR. ERROR. ERROR. YOU SUCK.
Why are there so many data types in various databases?
Because then we can ensure that invalid data doesn’t get into the database - runtime errors are annoying but they’re far better than trying to fix a db that has allowed invalid data into the db.
How do you select particular columns within SQL?
“<img></img>”
“What does this return?<div><img></img><br></br></div>”
[{age: 36, name: ‘Amir’}] - It returns columns in the order requested, not the order they’re in in the DB
What is the standard equality operator in SQL?
= (not == or === )
How do you select using the where condition?
“<img></img>”
Can a where query and a select reference different columns?
“Yes,<div><img></img><br></br></div>”