Use LEFT and RIGHT arrow keys to navigate between flashcards;
Use UP and DOWN arrow keys to flip the card;
H to show hint;
A reads text to speech;
48 Cards in this Set
- Front
- Back
What category of SQL statements would the following statement fragment be classified?
UPDATE Price SET Price = Price * 1.25 ... A. DDL B. DML C. SQL D. DCL |
B. DML
DDL = Data Definition Language (CREATE USER user_name) DML = Data Manipulation Language (INSERT, UPDATE, DELETE) DQL = SQL Select Statements (SELECT ProductID, Name, List Price FROM Production.Product) DCL = Data Control Language (GRANT CONNECT TO guest; GRANT CONTROL SERVER TO user_name;) TCL = Transactional Control Language (COMMIT TRANSACTION Inner2;) |
|
What is normalization?
|
The process of removing redundant data from a database.
|
|
What are benefits of normalization?
|
-Accelerates sorting and indexing
-Allows more clustered indexes -Helps INSERT and UPDATE performance -More compact databases |
|
What are disadvantages of normalization?
|
-Increase in tables to join
-slower data retrieval -insertion of code in tables -difficulty in data model query Denormalization (monolithic table) is better for running reports and queries |
|
what's a table?
|
contain all the data in SQL Server databases
|
|
what's a view?
|
acts like a virtual table or a stored query
|
|
what are indexes?
|
enable fast retrival, built from one or more columns in table or view
|
|
what are triggers?
|
execute a batch of SQL code when an insert, update or delete command is executed against a specific table
|
|
what are procedures?
|
accept parameters, contain statements, and return values
|
|
what are constraints?
|
prevent inconsistent data from being placed in a column
|
|
what are rules?
|
specify acceptable values that can be inserted in a column
|
|
What is DML
|
Data Manipulation Language - allow you to modify underlying data in your tables. Insert, Update, Delete
ex. INSERT Table1 VALUES (1, 'Row #1') |
|
What is DCL
|
Data Control Language - allows you to work with permissions/security of underlying database objects.
ex. GRANT CONNECT TO guest; GRANT CONTROL SERVER TO user_name; |
|
What is DDL |
Data Definition Language - allow you to create the objects that comprise your database.
ex. CREATE USER user_name |
|
What is TCL
|
Transactional Control Language - commit, rollback, begin trans
ex. COMMIT TRANSACTION Inner2; |
|
What is DQL
|
SQL Select Statements - allows querying data.
ex. SELECT ProductID, Name, ListPrice FROM Production.Product |
|
How do you declare a variable for a stored procedure?
|
DECLARE @local_variable as <data_type>
sample: declare @food varchar(20) set @food = 'ice cream' ... WHERE Description = @food |
|
Control-of-Flow Keywords?
|
BEGIN...END
GOTO IF...ELSE RETURN BREAK CONTINUE WHILE WAITFOR |
|
Sample IF?
|
IF Boolean_expression
BEGIN { sql_statement |
|
What are Batch Directives?
|
They control the movement within a T-SQL file.
GO - if you have a lot of SELECT statements you can use a GO to separate from another batch EXEC - used for executing a Stored Procedure BEGIN END |
|
GO
|
Delineates batches of T-SQL statement to tools and utilities'
Is not an actual T-SQL statement |
|
EXEC
|
Executes a user-defined function, system procedure, user-defined stored procedure, or an extended stored procedure
Controls the execution of a character string within a Transact-SQL batch |
|
How do you add comments in T-SQL?
|
/*
This is a comment */ OR --This is a comment |
|
SQL Server Management Studio
|
used for interactive creation of T-SQL scripts
used to access, configure, manage, and create many other SQL Server objects |
|
Tools for Querying SQL Server Databases
|
SQL Server management Studio
Microsoft Office Excel SQLCMD PowerShell |
|
SQLCMD
|
A command used by administrators for command line and batch files processing
SQLCMD -S server\instance -i C:\script |
|
PowerShell
|
An environment used by administrators for command line and batch processing
|
|
Introduction to SQL Server Management Studio
|
Support for writing and editing queries or scripts
Integrated source control for solution and script projects Supports most administrative tasks for SQL Server An integrated Web browser for quick browsing |
|
What are the SQL Server Components
|
SQL Server Database Engine:
Core service for storing and processing data in your database. Analysis Services: Tools that allow you to create and manage analytical processing such as statistics Reporting Services: Allow you to create and deploy reports Integration Services: Used for moving, copying, or transforming data between databases and different kinds of databases |
|
What are the SQL Server Management tools
|
SQL Server Management Studio: An environment to access, configure, manage, and administer SQL components
SQL Server Configuration Manager: An interface to provide management for SQL services, protocols, and client aliases SQL Server Profiler: A GUI tool to profile and trace the Database Engine and Analysis Services Database Engine Tuning Advisor: An application to create optimal sets of indexes, indexed views, and partitions Business Intelligence Development Studio : An IDE for creating Analysis Services, Reporting Services, and Integration Services solutions |
|
The SQL Server ____ Studio is an environment that allows you to access, configure and manage SQL Server components within a Graphical interface.
A. Reporting B. Management C. Profiler D. Configuration |
B. Management
|
|
Scalar functions return a ___?
A. Cache B. Result Set C. XML result D. Single value |
D. Single value
|
|
There are 5 main levels of Database Normalization. What level is the most reasonable level implemented in most database designs?
A. First B. Second C. Third D. Fifth |
C. Third
|
|
Which of the following is considered a valid local variable declaration in T-SQL?
A. @age int B. @@count int C. #data DateTime2 D. ##date DateTime2 |
A. @age int
|
|
Which SQL Server component service is responsible for handling the Core storing and processing of data?
A. Integration services B. Database Engine service C. Analysis services D. Query Integration services |
B. Database Engine service
|
|
What is the main difference between triggers and stored procedures?
A. Stored procedures are attached to tables B. A trigger is attached to a single table C. Stored procedures are written in managed code D. Triggers can be written with T-SQL |
B. A trigger is attached to a single table
|
|
True or False: The primary job of a constraint is to enforce a rule in the database.
|
True
|
|
What T-SQL statement is used to raise a custom error?
A. RETURNERROR B. THROW C. RAISEERROR D. ERROR.RAISE |
C. RAISEERROR
|
|
What SQL Server tool would you use to execute the following statement?
'TOOLNAME' -S servername -i c:\scriptname.sql A. Query Tool B. Database Script Tool C. SQLCMD D. PowerShell |
C. SQLCMD
|
|
What category of SQL statements would the following statement fragment be classified?
UPDATE Price SET Price = Price * 1.25 .. A. DDL B. DML C. SQL D. DCL |
B. DML
|
|
Which SQL Server component service is responsible for handling the Core storing and processing of data?
Integration services Database Engine service Analysis services Query Integration services |
Database Engine service
The SQL Server Database Engine component provides the Core service for storing and processing data. |
|
The SQL Server ______ Studio is an environment that allows you to access, configure and manage SQL Server components within a Graphical Interface.
Reporting Management Profiler Configuration |
Management
The SQL Server Management Studio (SSMS) is an environment that allows you to access, configure and manage SQL Server components within a Graphical Interface. |
|
What is first normal form?
|
Involves making sure that you don't have duplicate data in your tables.
|
|
Second Normal Form
|
Making sure that fields in table are all related to any one field
|
|
Third Normal Form
|
Can not have any derived or calculated fields. Calculations would be done in queries or reports
|
|
what are the 4 primary properties to the SELECT statement?
|
1) the number and attributes of the columns in the result set
SELECT ProductID, Name, ListPrice 2) The tables from which the result set data is retrieved FROM Production.Product 3) The conditions the rows in the source tables must meet WHERE ListPrice > $40 4) The sequence which the rows of the result set are ordered ORDER BY ListPrice ASC SELECT ProductID, Name, ListPrice FROM Production.Product WHERE ListPrice > $40 ORDER BY ListPrice ASC |
|
What are the types of T-SQL functions?
|
Rowset Functions
Return an object that can be used like table references in an SQL statement. Example: OpenQuery function Aggregate Functions Operate on a collection of values but return a single, summarizing value. Example: Average function Ranking Functions Return a ranking value for each row in a partition. Example: Rank and Dense functions Scalar Functions Operate on a single value and then return a single value. Scalar functions can be used wherever an expression is valid. Example: Cubic Volume |
|
How is Microsoft Excel typically used with SQL Server?
|
A spreadsheet used by financial and business professional to retrieve data.
|