Podcast
Questions and Answers
What is the primary purpose of the tutorial on Writing Transact-SQL Statements?
What is the primary purpose of the tutorial on Writing Transact-SQL Statements?
What does Transact-SQL represent in the context of SQL Server?
What does Transact-SQL represent in the context of SQL Server?
What kind of users is the tutorial intended for?
What kind of users is the tutorial intended for?
Which of the following statements is accurate regarding the complexity of the examples used in the tutorial?
Which of the following statements is accurate regarding the complexity of the examples used in the tutorial?
Signup and view all the answers
What aspect is NOT a focus of the tutorial on Writing Transact-SQL Statements?
What aspect is NOT a focus of the tutorial on Writing Transact-SQL Statements?
Signup and view all the answers
What is the first step to create a new Windows account on your computer?
What is the first step to create a new Windows account on your computer?
Signup and view all the answers
Which statement correctly describes the function of 'FROM WINDOWS' in the CREATE LOGIN syntax?
Which statement correctly describes the function of 'FROM WINDOWS' in the CREATE LOGIN syntax?
Signup and view all the answers
What is required to create a database in SQL Server?
What is required to create a database in SQL Server?
Signup and view all the answers
What must you do after creating a login for Mary to allow her to access the TestData database?
What must you do after creating a login for Mary to allow her to access the TestData database?
Signup and view all the answers
Which utility can be used to submit Transact-SQL statements aside from SQL Server Management Studio?
Which utility can be used to submit Transact-SQL statements aside from SQL Server Management Studio?
Signup and view all the answers
Why must the login for Mary be created on each instance of SQL Server she needs to access?
Why must the login for Mary be created on each instance of SQL Server she needs to access?
Signup and view all the answers
What is required of you in order to create a new Windows user account?
What is required of you in order to create a new Windows user account?
Signup and view all the answers
Which of the following is NOT mentioned as an installation requirement for the tutorial?
Which of the following is NOT mentioned as an installation requirement for the tutorial?
Signup and view all the answers
What does the CREATE DATABASE statement require as a parameter?
What does the CREATE DATABASE statement require as a parameter?
Signup and view all the answers
Which parameter is optional when creating a login for Mary with a default database?
Which parameter is optional when creating a login for Mary with a default database?
Signup and view all the answers
Which of the following statements about Mary is true after you create her login?
Which of the following statements about Mary is true after you create her login?
Signup and view all the answers
What is one of the first steps to start using Transact-SQL in SQL Server Management Studio?
What is one of the first steps to start using Transact-SQL in SQL Server Management Studio?
Signup and view all the answers
What does the expression 'Price * 1.07' represent in the SQL query?
What does the expression 'Price * 1.07' represent in the SQL query?
Signup and view all the answers
What is the role of the CREATE USER statement in this context?
What is the role of the CREATE USER statement in this context?
Signup and view all the answers
Which SQL statement is used to create a new database?
Which SQL statement is used to create a new database?
Signup and view all the answers
When the CREATE DATABASE statement is executed without optional parameters, what values does SQL Server use?
When the CREATE DATABASE statement is executed without optional parameters, what values does SQL Server use?
Signup and view all the answers
What feature is recommended to be added to the document viewer toolbar during tutorials?
What feature is recommended to be added to the document viewer toolbar during tutorials?
Signup and view all the answers
What is the first step to grant a user access to a database?
What is the first step to grant a user access to a database?
Signup and view all the answers
Which task is NOT covered in the described lesson about creating database objects?
Which task is NOT covered in the described lesson about creating database objects?
Signup and view all the answers
Which of the following is a category of functions usable in SELECT statements?
Which of the following is a category of functions usable in SELECT statements?
Signup and view all the answers
What is the purpose of creating a view in SQL?
What is the purpose of creating a view in SQL?
Signup and view all the answers
What is the role of the ProductID column in the Products table?
What is the role of the ProductID column in the Products table?
Signup and view all the answers
What SQL statement is used to modify existing records in a database?
What SQL statement is used to modify existing records in a database?
Signup and view all the answers
What type of authentication is recommended when creating a login for SQL Server?
What type of authentication is recommended when creating a login for SQL Server?
Signup and view all the answers
Which of the following data types is used for the Price column in the Products table?
Which of the following data types is used for the Price column in the Products table?
Signup and view all the answers
Which SQL command would you use to retrieve all columns from a table?
Which SQL command would you use to retrieve all columns from a table?
Signup and view all the answers
What is indicated by the column alias 'CustomerPays' in the SQL query?
What is indicated by the column alias 'CustomerPays' in the SQL query?
Signup and view all the answers
In the CREATE TABLE statement for Products, which columns are allowed to be NULL?
In the CREATE TABLE statement for Products, which columns are allowed to be NULL?
Signup and view all the answers
What statement is used to switch the connection to the TestData database after creation?
What statement is used to switch the connection to the TestData database after creation?
Signup and view all the answers
In SQL Server, which step follows creating a login when granting database access?
In SQL Server, which step follows creating a login when granting database access?
Signup and view all the answers
What does the WHERE clause do in a SELECT statement?
What does the WHERE clause do in a SELECT statement?
Signup and view all the answers
When inserting data, which of the following statements correctly describes the INSERT syntax?
When inserting data, which of the following statements correctly describes the INSERT syntax?
Signup and view all the answers
What will the following SQL command return? SELECT ProductName, Price FROM dbo.Products;
What will the following SQL command return? SELECT ProductName, Price FROM dbo.Products;
Signup and view all the answers
What is the consequence of not specifying a column list while selecting data?
What is the consequence of not specifying a column list while selecting data?
Signup and view all the answers
Which SQL command would you use to modify an existing row in the Products table?
Which SQL command would you use to modify an existing row in the Products table?
Signup and view all the answers
Which clause is essential in the UPDATE statement to target a specific row?
Which clause is essential in the UPDATE statement to target a specific row?
Signup and view all the answers
What is the primary purpose of using the AS keyword in a SELECT statement?
What is the primary purpose of using the AS keyword in a SELECT statement?
Signup and view all the answers
What is the recommended practice when writing SELECT statements for permanent code?
What is the recommended practice when writing SELECT statements for permanent code?
Signup and view all the answers
In the context of the Products table, what does 'dbo' represent?
In the context of the Products table, what does 'dbo' represent?
Signup and view all the answers
If you need to perform a mathematical operation on the Price column during a SELECT operation, what will happen if you do not use AS?
If you need to perform a mathematical operation on the Price column during a SELECT operation, what will happen if you do not use AS?
Signup and view all the answers
Study Notes
SQL Server 2012 Tutorials: Writing Transact-SQL Statements
- This tutorial is for new SQL statement users
- It covers basic statements for creating tables and inserting data
- It uses Transact-SQL (Microsoft's SQL implementation)
- It's a brief introduction, not a replacement for a Transact-SQL class
- Statements are simplified and do not reflect production database complexity
- Applicable to SQL Server 2012
- Source: SQL Server Books Online
- Publication date: June 2012
Tutorial Contents
-
Lesson 1: Creating Database Objects
- Creating a database (Tutorial)
- Creating a table (Tutorial)
- Inserting and updating data in a table (Tutorial)
- Reading data in a table (Tutorial)
- Summary: Creating database objects
-
Lesson 2: Configuring Permissions on Database Objects
- Creating a login
- Granting access to a database
- Creating views and stored procedures
- Granting access to a database object
- Summary: Configuring permissions on database objects
-
Lesson 3: Deleting Database Objects
- Deleting database objects
Requirements
- Any edition of SQL Server
- SQL Server Management Studio or Management Studio Express
- Internet Explorer 6 or later (or equivalent)
Creating a Database (Procedure)
- Use the CREATE DATABASE statement
- The database name is required
- Optional parameters exist for disk location
- SQL Server uses default values when no optional parameters are provided
Creating a Table (Procedure)
- Provide a table name and column definitions
- Primary keys should be used for uniqueness
- Data types and NULL values (allowing empty fields) must be specified
Inserting and Updating Data (Procedure)
- INSERT statement to insert data into a table
- UPDATE statement to modify existing data
- WHERE clause for specific row updates
Reading Data (Procedure)
- Use the SELECT statement for data retrieval
- The syntax can include columns; all columns; or a WHERE clause for filtering
Creating Views and Stored Procedures
- Views are stored SELECT statements
- Stored procedures are sets of Transact-SQL statements
- Stored procedures can accept inputs and outputs, managing flow.
Granting Access to Objects
- Use the GRANT statement to give users permissions (e.g., execute stored procedures)
- Executing (or running) a stored procedure requires EXECUTE permission.
- To remove permissions use REVOKE
Deleting Objects
- Use DROP statements to remove procedures, views, tables, and databases
Studying That Suits You
Use AI to generate personalized quizzes and flashcards to suit your learning preferences.
Related Documents
Description
This tutorial is designed for beginners learning to write Transact-SQL statements in SQL Server 2012. It covers the basics of creating tables, inserting data, and configuring permissions for database objects, providing a simplified introduction to T-SQL. Perfect for new users looking to get started with SQL Server.