Foundations of Querying Flashcards
Work with Data Query data by using SELECT statements
Writing in a __________ way is considered a best practice.
standard
True or False: You should consider a nonstandard option only when it has some important benefit to you that is not covered by the standard alternative.
True
Standard SQL is based on the _________ ________, which is a mathematical model for data management and manipulation.
relational model
Define: Relational Model
A mathematical model for data management and manipulation.
Who created and proposed the relational model?
Edgar F. Codd in 1969
A relation in the relational model is what SQL calls a _____.
table
What does a relation have?
A heading and a body.
Define: Heading
A set of attributes (what SQL attempts to represent with columns), each of a given type.
Define: Attribute
An attribute is identified by name and type name.
Define: Body
A set of tuples (what SQL attempts to represent with rows). Each tuple’s heading is the heading of the relation. Each value of each tuple’s attribute is of its respective type.
Define: Set
A set is any collection M into a whole of definite, distinct objects m (which are called the elements of M) of our perception or of our thought.
A _________ is an expression that when attributed to some object, makes a proposition either true or false.
predicate.
True or False: A predicate is a parameterized proposition.
True.
List the conditions that must be true in order for a set to be relational.
1) Must not have duplicates
2) No relevance to the order of the elements
3) All attributes must have names
4) All attributes must have unique names
SQL implements one general purpose mark called ____ for any kind of missing value.
NULL
What are the mathematical branches that the relational model is based on?
Set theory and predicate logic.
What is the difference between T-SQL and SQL?
SQL is standard; T-SQL is the dialect of and extension to SQL that Microsoft implements in its RDBMS - SQL Server.
Multiple Choice: Why is it important to use standard SQL code when possible and know what is standard and what isn’t? (Choose all that apply)
A. It is not important to code using standard SQL.
B. Standard SQL code is more portable between platforms.
C. Standard SQL code is more efficient.
D. Knowing what standard SQL code is makes your knowledge more portable.
B and D
Multiple Choice: Which of the following is not a violation of the relational model?
A. Using ordinal positions for columns
B. Returning duplicate rows
C. Not defining a key in a table
D. Ensuring that all attributes in the result of a query have names
D
Multiple Choice: What is the relationship between SQL and T-SQL?
A. T-SQL is the standard language and SQL is the dialect in Microsoft SQL Server.
B. SQL is the standard language and T-SQL is the dialect in Microsoft SQL Server.
C. Both SQL and T-SQL are standard languages.
D. Both SQL and T-SQL are dialects in Microsoft SQL Server.
B
Define: Logical Query Processing
The conceptual interpretation of the query that defines the correct result
True or False: It is important to draw performance-related conclusions from logical query processing.
False
Define: What is the “keyed-in order” of the main T-SQL query clauses?
1) SELECT
2) FROM
3) WHERE
4) GROUP BY
5) HAVING
6) ORDER BY
Define: What is the logical query processing order of the six main query clauses?
1) FROM
2) WHERE
3) GROUP BY
4) HAVING
5) SELECT
6) ORDER BY