postgres Flashcards
What is PostgreSQL and what are some alternative relational databases?
PostgreSQL is a powerful, free, open source Relational Database Management System (RDBMS).
some altenratives are SQL server, MySQL, oracle
What are some advantages of learning a relational database?
A quality of many relational databases is that they support good guarantees about data integrity.
Relational databases are arguably the most widely used kind of database
What is one way to see if PostgreSQL is running?
sudo service postgresql status
What is a database schema?
A collection of tables is called a schema. A schema defines how the data in a relational database should be organized. In relational databases, you typically have to define your schema up front and the database server will make sure that any data being written to the database conforms to that schema.
What is a table?
relational databases store data in relations, commonly referred to as tables. A table is a list of rows each having the same set of attributes. columns are often referred to as attributes.
What is a row?
rows are the single record of data
What is SQL and how is it different from languages like JavaScript?
How do you retrieve specific columns from a database table?
How do you filter rows based on some specific criteria?
What are the benefits of formatting your SQL?
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?
How do you retrieve all columns from a database table?
How do you control the sort order of a result set?
Structured Query Language (SQL) is the primary way of interacting with relational databases. It is a powerful way of retrieving, creating, and manipulating data in a relational database. SQL is a declarative language, not imperative. imperative you have to tell each step.
How do you filter rows based on some specific criteria?
select “attributeName”,
from “tableName”
how do you filter rows based on specific criteria?
select “attributes”,
from “tablename,
where “attribute” = ‘alvin’;
What are the benefits of formatting your SQL?
cleaner easier to read
What are four comparison operators that can be used in a where clause?
= < > between
How do you limit the number of rows returned in a result set?
use the limit clause
How do you retrieve all columns from a database table?
select *
How do you add a row to a SQL table?
insert into “products” (“name”, “description”, “price”, “category”)
values (‘Ostrich Pillow’, ‘Feel comfy and cozy!’, 99, ‘self care’),
(‘Tater Mitts’, ‘Scrub some taters!’, 6, ‘cooking’)
returning *;
What is a tuple?
In SQL, a list of values is referred to as a tuple.