LFZ Quiz questions (Senior #3) Flashcards
(postgres-intro)
What is PostgreSQL and what are some alternative relational databases?
PostgreSQL is one of the relational database. Other popular relational databases include MySQL (also free), MariaDB, MongoDB, SQL Server by Microsoft, and Oracle by Oracle Corporation.
(postgres-intro)
What are some advantages of learning a relational database?
Many problem domains can be modeled well using a relational database. If you are storing related data, then a relational database is probably a good first choice!
This model organizes data into one or more tables (or “relations”) of columns and rows, with a unique key identifying each row.
(postgres-intro)
What is one way to see if PostgreSQL is running?
We can use a command ‘top’ to see the process of postgres
(postgres-database)
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. bunch of tables.
(postgres-database)
What is a table?
A table is a list of rows each having the same set of attributes.
(postgres-database)
What is a row?
A row represents a single, implicitly structured data item in a table.
Whereas, Attributes are commonly referred to as columns.
(sql-select)
What is SQL and how is it different from languages like JavaScript?
SQL is Structured Query Language and declarative programming language. In declarative languages, programmers describe the results they want and the programming environment comes up with its own plan for getting those results.
(sql-select)
How do you retrieve specific columns from a database table?
The select keyword is followed by specific column’s name
(sql-select)
How do you filter rows based on some specific criteria?
We can use a keyword ‘where’ and “column name” = ‘criteria’
(sql-select)
What are the benefits of formatting your SQL?
It’s easy to read and alter values.
dynamically generate a plan of action to perform the programmer’s commands as efficiently as possible.
(sql-select)
What are four comparison operators that can be used in a where clause?
=, , !=, <=, >=, etc
(sql-select)
How do you limit the number of rows returned in a result set?
We can use limit keyword and number
ex) limit 5
(sql-select)
How do you retrieve all columns from a database table?
select * from “table name”
(sql-select)
How do you control the sort order of a result set?
We can use order by keyword
ex) order by “column name” desc / asc
(sql-insert)
How do you add a row to a SQL table?
ex)
insert into “products” (“name”, “description”, “price”, “category”)
values (‘Ostrich Pillow’, ‘Feel comfy and cozy!’, 99, ‘self care’);