Module 2 Flashcards
What are the standard BIG FIVE aggregate functions? What are these functions used for?
- These functions are MIN(), MAX(),
- SUM(), AVG(), and COUNT().
- SQL Server also provides additional aggregate functions.
- Aggregate functions are used (many times in conjunction with GROUP BY and
- HAVING) to summerize data.
What types of code can be used in a stored procedure?
- T-SQL or Transact SQL and CLR or
- Common Language Runtime can be used to program stored procedures
If you user an aggregate function within a view, that view will no longer be updatable, which means you will only be able to use that view to retrieve or SELECT data. Why?
- Aggregate data cannot map back to a particular row in underlying tables,
- so the DBMS will not know how to update the underlying table to prioduce the indicated changes in the aggregated data.
What is the difference between Data Control Language (DCL), Data Definition Language (DDL) and Data Manipulation Language (DML)?
- All three are components of SQL.
- DCL - configures local security in the database allowing you to create users and roles as well as grant permissions to database objects
- DDL - provides the facility to create and manage the logical schema in a database.
- DML - provides the ability to query and manipulate data nad is the most widely used of the three components of SQL.
What is the difference between a declarative programming language and an imparative programming language?
- Using an imperative langauge you want to specify what you want to happen step by step.
- In a declarative langauge you organize set of statements that describe what you want to happen.
- In a declarative language you do not specify what you want to happen step by step.
4.
Why is an inline UDF sometimes called a VIEW that can accept parameters?
can return a table or set of data based on a parameters
How do you change the database context?
This is achieved by USE <database></database>
What is the primary purpose of a stored procedure and how does a stored procedure differ from a trigger?
- Stored procedures can be used to define an APL encapsulate complex logic, and provde flow control or repetition (more complicated program logic.)
- A trigger can contain similar code, but the code excutes when specific events happen (related to insert, update, delete, and logon.).
What is the difference between a correlated subquery and a non-correlated subquery? What are the uses of each?
- A correlated subquery is a subquery that references the columns in the outer query. In a correlated subquery,
- the inner query runs one time for each row in the outer subquery. In a non-correlated subquery on the other had this does not happen.
- The inner query runs once.
- Correlated subqueries are used to create complicated queries to accomplish data retrieval tasks that cannot be accomplished other ways (such as using a join.)
- A non-correlated subquery is used to create more dynamic code that does not require the author of the code to know all the intermediate values in the database.
The correct usages for UNION, UNION ALL, EXCEPT, and INTERSECT.
- combine multiple queries using the set operators
- Set operators combine results from two or more queries into a single result set.
What types of constraints did we talk about in SQL Server?
- We talked about check constraints,
- NOT NULL constraints,
- PRIMARY KEY constraints, and
- FOREIGN KEY constraints (as part of RELATIONAL INTEGRITY constraints).
The process for performing all joins (INNER JOIN, LEFT OUTER JOIN, RIGHT OUTER JOIN, and FULL OUTER JOIN).
- An SQL JOIN clause is used to combine rows from two or more tables,
- based on a common field between them.
What is a qualified name?
- a combination of identifiers that uniquely defines the location of a database object.
- constructed by using up to four identifiers that represent the logical structure
- represents hierarchy of the SQL Server instance, the database name, the database schema, and the database object.
What is a Partitioned View?
- This is a view which displays horizontally divided data from a set of member tables across one or more servers,
- making the data appear as if it is from one table
What is the database operation you would choose to merge and retrive data stored in more than one table or view?
This is a JOIN peration (either INNER, LEFT OUTER, RIGHT OUTER, or FULL OUTER)