Chapter 18 - Introduction to SQL Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

What is SQL?

A

» SQL is a declarative language used to query and update tables in a relational database

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

What does the SELECT command do?

A

» Used to extract a collection of fields from a given table

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

What does the FROM command do?

A

» Specifies from which table the data will come from

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

What does the WHERE command do?

A

» Lists the search criteria

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

What does the ORDER BY command do?

A

» List the fields that the results are to be sorted on

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

What is one key feature to remember about the ORDER BY command?

A

» Default order is always ASC

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

What are the 2 types of commands in the ORDER BY statement?

A

» ASC
» DESC

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

What does the = command mean?

A

» Equal to
» Such as Title = “Death note”

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

What does the != command mean?

A

» Not equal to

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

What does the >= command mean?

A

» Greater than or equal to

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

What does the <= command mean?

A

» Less than or equal to

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

What does the IN command do?

A

» Equal to a value within a set of values

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

What is the LIKE command?

A

» Similiar to

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

What does the BETWEEN..AND command mean?

A

» Within a range
» Such as Datepublish BETWEEN 01 AND 31

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

What is the IS NULL operator?

A

» Field does not contain a value

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

What is the standard structure of a SQL query?

A

» SELECT
» FROM
» WHERE
» ORDER BY

17
Q

What is the * operator?

A

» A wild card, selects all the fields of records

18
Q

What are the commands to combine data from two or more tables, by only specifying which table the data is held in?

A

» Using the syntax:
» tablename.fieldname
» Then use multiple instances of this syntax to combine the tables

19
Q

What is one thing to remember when joining data from two or more table?

A

» The table name is optional unless the field name appears in more than one table

20
Q

How can you provide a link between tables in SQL?

A

» Using a condintion in the WHERE clause, such as eg..
» WHERE song.artistID = Artist.ArtistID

21
Q

What is an alternative method of combining rows from two or more tables?

A

» Using the SQL JOIN command

22
Q

When can the JOIN command be used?

A

» Can be used to combine data from two or more tables by specifying a common field between them

23
Q

What is the main command of the JOIN operator?

A

» JOIN tablename
» ON tablename.field = tablename.field
» Note the table name is the other table which is not in the FROM statement

24
Q

What is one key thing to remeber after using the JOIN command?

A

» Remember to specify the table where the field is coming from
» Usually just do the table in which it is in the FROM statement then dot the record which links the 2 tables

25
Q

What is the main overall structure of the SQL query when there is a JOIN command?

A

» SELECT
» FROM
» JOIN
» ON
» WHERE