SQL Flashcards Preview

Web Development > SQL > Flashcards

Flashcards in SQL Deck (27)
Loading flashcards...
1

What is PostgreSQL and what are some alternative relational databases?

a free open source Relational Database Management System, MySQL, SQL Server (Microsoft), Oracle (Oracle Corporation)

2

What are some advantages of learning a relational database?

they are the most widely used kind of database

3

What is one way to see if PostgreSQL is running?

sudo service postgresql status or top

4

What is a database schema?

a description of how data should be structured

5

What is a table?

a list of rows having the same set of attributes

6

What is a row?

all of the data for an individual entry

7

What is SQL and how is it different from languages like JavaScript?

Structured Query Language, the primary way of interacting with relational databases, declarative programming language (like HTML and CSS)

8

How do you retrieve specific columns from a database table?

select "column", from "table"

9

How do you filter rows based on some specific criteria?

where "column" = 'value'

10

What are the benefits of formatting your SQL?

readability, style consistency

11

What are four comparison operators that can be used in a where clause?

=, , !=

12

How do you limit the number of rows returned in a result set?

limit #

13

How do you retrieve all columns from a database table?

select *

14

How do you control the sort order of a result set?

order by "column" (desc)

15

How do you add a row to a SQL table?

insert into "table" ("column")
values ('value')

16

What is a tuple?

a list of values

17

How do you add multiple rows to a SQL table at once?

specify more than one tuple of values, separated by commas

18

How do you get back the row being inserted into a table without a separate select statement?

returning clause

19

How do you update rows in a database table?

update "table"
set "column" = 'value'
where "column" = 'value'

20

Why is it important to include a where clause in your update statements?

if where clause isn't used, all rows would be updated

21

How do you delete rows from a database table?

delete from "table"
where "column" = 'value'

22

How do you accidentally delete all rows from a table?

by not including a where clause

23

What is a foreign key?

a column that links tables together

24

How do you join two SQL tables?

join "table" using ("column")

25

How do you temporarily rename columns or tables in a SQL statement?

create an alias by using as keyword
select "column" as "alias"

26

What are some examples of aggregate functions?

max( ), count( ), min( ), sum( )

27

What is the purpose of a group by clause?

to separate rows into groups and perform aggregate functions on those groups