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.
SQL is used to answer questions both within and across what?
relational databases tables
You should analyze data in a spreadsheet if what two conditions are met?
1) data can fit in a spreadsheet
2) does not relate to other data
What are keywords?
reserved words used to indicate what operations we want our code to perform
What are the two most common keywords?
SELECT and FROM
The SELECT keyword indicates what?
indicates which field should be selected from a table
The FROM keyword indicates what?
indicates the table in which the selected fields are located
What are 3 best practices with writing a query?
1) end query with a semicolon
2) capitalize keywords
2) keep tables/field names lowercase
The results of a query is called what?
a result set
True/False - Querying a databases with SQL changes the underlying database.
False - a query does not change the database itself or its tables rather it only changes the results
True/False - We can save the SQL we write so that our collaborators can use it to query the database themselves.
True
How can you change the order that fields are listed in the SQL output?
change the order of the field names after the SELECT keyword to change their order
How can you select all the fields from a table without listing them out?
SELECT *
What can we use to rename columns in SQL?
Aliasing
What keyword do we use to alias a column?
AS
What keyword do we use to get a list of records with only unique values?
SELECT DISTINCT