Introduction to SQL - Introducing Queries Flashcards

Learn your first SQL keywords for selecting relevant data from database tables! After practicing querying skills in a database of books, you’ll customize query results using aliasing and save them as views so they can be shared. Finally, you’ll explore the differences between SQL flavors and databases such as PostgreSQL and SQL Server.

1
Q

SQL is used to answer questions both within and across what?

A

relational databases tables

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

You should analyze data in a spreadsheet if what two conditions are met?

A

1) data can fit in a spreadsheet
2) does not relate to other data

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What are keywords?

A

reserved words used to indicate what operations we want our code to perform

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What are the two most common keywords?

A

SELECT and FROM

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

The SELECT keyword indicates what?

A

indicates which field should be selected from a table

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

The FROM keyword indicates what?

A

indicates the table in which the selected fields are located

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What are 3 best practices with writing a query?

A

1) end query with a semicolon
2) capitalize keywords
2) keep tables/field names lowercase

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

The results of a query is called what?

A

a result set

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

True/False - Querying a databases with SQL changes the underlying database.

A

False - a query does not change the database itself or its tables rather it only changes the results

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

True/False - We can save the SQL we write so that our collaborators can use it to query the database themselves.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

How can you change the order that fields are listed in the SQL output?

A

change the order of the field names after the SELECT keyword to change their order

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

How can you select all the fields from a table without listing them out?

A

SELECT *

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What can we use to rename columns in SQL?

A

Aliasing

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What keyword do we use to alias a column?

A

AS

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What keyword do we use to get a list of records with only unique values?

A

SELECT DISTINCT

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

If we use DISTINCT with multiple fields what gets returned?

A

only unique combinations of the fields will be returned but the fields themselves may still have duplicate values

17
Q

What is a view in SQL?

A

a saved SQL SELECT statement in the form of a virtual table

18
Q

The data a view contains is not generally stored in a database, rather it is the what that gets stored for future use?

A

query code

19
Q

What is a benefit of accessing views?

A

automatically updates when the data does

20
Q

True/False - There is no result set when creating a view.

A

True

21
Q

True/False - Once a view is created we can query it the same as a normal table by selecting from it.

A

True

22
Q

True/False - Once a view is created we can query it the same as a normal table by selecting from it.

A

True

23
Q

What are 5 characteristics of different SQL flavors?

A

1) both free and paid
2) all used with relational databases
3) majority of keywords are the same
4) all must follow universal standards
5) only the additions on top of these standards make flavors different

24
Q

What are the two most popular flavors of SQL?

A

1) PostgreSQL
2) SQL Server

25
Q

Where was PostgreSQL created? Who sponsored it?

A

University of California, Berkley that was sponsored by DARPA

26
Q

Who created SQL Server?

A

Microsoft

27
Q

What is Microsoft’s SQL flavor that is used with SQL server databases?

A

T-SQL

28
Q

Comparing PostgreSQL and SQL Server is like comparing what?

A

dialects of the same language (English/UK)