postgresSL / SQL Flashcards
Why do we use databases in Web development?
To store data to be quickly retrieved, esp when it’s complex data and needs to be organized
They can also be used by many users and it provides a central location
What is PostgreSQL and what are some alternative relational databases?
PostgreSQL is a relational database.
Other popular relational databases include MySQL (also free), SQL Server by Microsoft, and Oracle by Oracle Corporation.
What are some advantages of learning a relational database?
Good data integrity (rejects “bad” data) (see below)
A quality of many relational databases is that they support good guarantees about data integrity. They can store and modify data in a way that makes data corruption as unlikely as possible. This means that developers can set up their database to reject “bad” data and not worry about data being “half written”.
What is one way to see if PostgreSQL is running?
also, using the “sudo service postgresql status” command
using the “top” command and watching for it in the list of processes
“sudo” stands for “super user do”, aka an admin LOL
what command starts the postgres database?
sudo service postgresql start
what command stops the postgres database?
sudo service postgresql stop
what command checks postgrest status?
sudo service postgresql status
what does the pgweb command do?
it runs a server and lets you access from the browser, it queries your databases and gives you a GUI - graphical user interface, or webpage, to work in
What is a database schema?
a collection of relations (relations are like tables with rows & columns)
or, definition of all that describes your database
What is a table?
it has rows and columns for data, and in coding is called a relations
What is a row?
horizontal grid section with attributes in each column
like an object
a row is like an instance of a class
What is an attribute and what other names are used to describe them?
a column
what is a “primary key”
like an ID, basically
it uniquely identifies the row
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?