PostgreSQL Flashcards
What is PostgreSQL and what are some alternative relational databases?
An open source Relational Database Management System (RDBMS); MySQL, SQL Server by Microsoft, and Oracle by Oracle Corporation.
What are some advantages of learning a relational database?
Relational databases are widely used and knowing the SQL language is a portable skill that allows you to work with other databases in the future. They are also good for supporting data integrity, they can store and modify data in a way that makes data corruption as unlikely as possible.
What is one way to see if PostgreSQL is running?
top command; sudo service postgresql status
What is a database schema?
A collection of tables; It tells your database how data should be organized
What is a table?
A list of rows with the same set of attributes
What is a row?
Each entry for the table
What is SQL and how is it different from languages like JavaScript?
SQL is a declarative programming language. Instead of telling the code what to do, you describe the results you want.
How do you retrieve specific columns from a database table?
select “column”
How do you filter rows based on some specific criteria?
where clause
What are the benefits of formatting your SQL?
Readability
What are four comparison operators that can be used in a where clause?
=, >, =, <=, <> (not equal)
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
How do you control the sort order of a result set?
order by “column”; desc if you want it in descending order
How do you add a row to a SQL table?
insert statement