SQL Flashcards
What is PostgreSQL and what are some alternative relational databases?
PostgreSQL is a free open-source relational database management system
What are some advantages of learning a relational database?
As a developer it is likely I will be working close to a database, so best to have knowledge of.
What is one way to see if PostgreSQL is running?
by running ‘sudo service postgresql status’ command
What is a database schema?
A collection of tables in a database.
What is a table?
A list of rows and columns that store data in relations.
What is a row?
A row is an entry in a table and every row contains the same set of attributes
What is SQL and how is it different from languages like JavaScript?
SQL is a declarative language like html/css whereas other languages like JavaScript are imperative programing languages.
Declarative languages typically describe the results they want and the program environment gets the result in what ever way the program environment wants. Imperative languages tell an environment what to do and how to do it.
How do you retrieve specific columns from a database table?
By using the select keyword follow by one or more column name wrapped in double quotes.
How do you filter rows based on some specific criteria?
By using the where clause
What are the benefits of formatting your SQL?
For consistent style and readability
What are four comparison operators that can be used in a where clause?
=, !=, , <=, >=
How do you limit the number of rows returned in a result set?
limit clause
How do you retrieve all columns from a database table?
- (asterisk)symbol
How do you control the sort order of a result set?
order by (use desc for descending order)
How do you add a row to a SQL table?
By using an insert statement