Set 1 Flashcards
(445 cards)
T-SQL is a dialect of what? SQL is a standard of which organizations? What are the major revisions of SQL?
standard SQL,ISO and ANSI, [ 86, 89, 92, 99, 03, 06, 08, 11, 16 ]
Is writing in the standard way a best practice? e.g. CAST vs CONVERT? The standard requires what as a terminator?
Yes, semicolon
What is the source for the term “relation”?
The heading of a relation is?
What is a relation?
What are the three characteristics of a SET?
What is a body?
What is meant by whole?
- Comes from the mathematical concept relation.
- A set of Attributes
- A relation has a heading and a body. The heading is a set of attributes and the body is a set of tuples. Relation is also the mathematical term for a table.
- Whole, same type, and distinct, so no order, no duplicates, same type.
N.O.T. - A body is a set of tuples.
- You don’t interact with individual elements but with the whole set.
What is a predicate?
Another definition of a predicate?
A predicate is an expression that when attributed to some object makes it true or false, for example, gamesplayed greater than 10, where city = Atlanta, or where person = James.
A predicate is a parameterized proposition.
What is a relational schema?
What is a relational database?
What is a relational schema consist of?
What is a relational instance?
- Made up of attributes.
- A relational database is a set of relations
- Relational name, name and type of each attribute, eg. Employee (EmpID:int, EmpName:varchar)
- Is a table made of attributes and tuples, or columns and rows.
Degree refers to what?
What does cardinality refer to?
To the number of attributes or columns in a relation.
Cardinaltiy refers to the number of rows.
What are values called in a relation or table?
What are the formal vs informal terms used?
What are the properties of a relation?
Domains
Informal: Table, Columns, Rows, Table definition, values Formal: relation, attributes, tuples, schema definition, domains.
Relation has a distinct name. Each cell contains one value. Each attributes is distinct name. Each tuple is distinct. The order of tuples and attributes has no significance.
How to avoid iterative solutions?
Thinking in iterative terms creates iterative solutions.
While predicates theoretically evaluate to only true or false, what is the exception in SQL?
NULL, which results in unknown., Codd theorized two types, applicable but missing, and missing but inapplicable. SQL only has NULL which still extends beyond just true/false.
Why should you not use fields and records as terminology?
Fields and records are physical, Fields are what you have in user interfaces in client applications, and records are what you have in files and cursors. Tables are logical and they have logical rows and columns.
Why is “NULL value” self-contradictory?
Because NULL has no value.
Why is * considered bad practice?
Possibly prevents SQL from using covering indexes. More traffic across the network. Table definition changes could pull more than you need.
Is using AS for aliasing standard? Why
Yes, because of this SELECT LastName FirstName from Person. Only one column is returned.
Which one is standard “” delimiter or [ ] delimiters?
”” is standard [] is proprietary.
Should you delimit?
Maybe not, if identifier is regular then doing so may clutter your code.
What is the precedence rules for logical evaluation of operators?
NOT>AND>OR
What is a statement in SQL?
A statement performs some kind of action or controls the flow of the code.
What is an expression in SQL?
An expression is a combination of one or more values, operators and SQL functions that evaluate to a value.
Is the Case keyword expression or statement?
Expression
Does where prevent the CAST failure? WHERE propertytype = ‘INT’ AND CAST(propertyval AS INT) > 10
No, the all-at-once concept does not require the evalution of the expressions from left to right. There is a short circuit concept but due other cost related reasons it may choose to process the expressions in a different order.
What happens to the predicate evaluates a column with NULL values?
The predicate evaluates to unknown for rows that have a NULL in the attribute, and that the WHERE clause discards such rows. So, looking for Employee <> N’Dave’ would also discard NULLs which are evaluated to unknown.
What do NULLS evaluate to in predicates
Nulls evaluate to unknown.
What is considered equal to a NULL?
Nothing is considered equal to a NULL.
How do you include NULL cases in your result?
Use IS NULL.