Create Views Using T-SQL 98-364 Database Administration Fundamentals LESSON 2.3a.

Slides:



Advertisements
Similar presentations
Query Methods (SQL). What is SQL A programming language for databases. SQL (structured Query Language) It allows you add, edit, delete and run queries.
Advertisements

Brian Alderman | MCT, CEO / Founder of MicroTechPoint Pete Harris | Microsoft Senior Content Publisher.
Structured Query Language Part I Chapter Three CIS 218.
Structured Query Language Chapter Three (Excerpts) DAVID M. KROENKE’S DATABASE CONCEPTS, 2 nd Edition.
Mgt 20600: IT Management & Applications Databases Tuesday April 4, 2006.
Working with SQL and PL/SQL/ Session 1 / 1 of 27 SQL Server Architecture.
From VS C# 2010 Programming, John Allwork 1 VS2010 C# Programming - DB intro 1 Topics – Database Relational - linked tables SQL ADO.NET objects Referencing.
Chapter 5 Lecture 2. Principles of Information Systems2 Objectives Understand Data definition language (DDL) and data dictionary Learn about popular DBMSs.
Structured Query Language Chapter Three DAVID M. KROENKE and DAVID J. AUER DATABASE CONCEPTS, 4 th Edition.
Lesson 31: Querying a Database. 2 Learning Objectives After studying this lesson, you will be able to:  Create, save, and run select queries  Design.
Module Title? DBMS Introduction to Database Management System.
PantherSoft Financials Queries Office of the Controller.
1 Overview of Databases. 2 Content Databases Example: Access Structure Query language (SQL)
Database A collection of related data. Database Applications Banking: all transactions Airlines: reservations, schedules Universities: registration, grades.
Database Security and Auditing: Protecting Data Integrity and Accessibility Chapter 6 Virtual Private Databases.
CSIS 4310 – Advanced Databases Virtual Private Databases.
1 INTRODUCTION TO DATABASE MANAGEMENT SYSTEM L E C T U R E
Simple Database.
Chapter 15: Using LINQ to Access Data in C# Programs.
Form and Graphical User Interfaces. Lesson plan More about queries More about entering data into a table Form.
CPS120: Introduction to Computer Science Lecture 19 Introduction to SQL.
Relational Databases Database Driven Applications Retrieving Data Changing Data Analysing Data What is a DBMS An application that holds the data manages.
1 Copyright © 2004, Oracle. All rights reserved. Introduction.
Database control Introduction. The Database control is a tool that used by the database administrator to control the database. To enter to Database control.
Database A database is a collection of data organized to meet users’ needs. In this section: Database Structure Database Tools Industrial Databases Concepts.
Prepared by Jennifer Kreie, New Mexico State UniversityHosted by the University of Arkansas Microsoft Enterprise Consortium SQL Fundamentals SELECT … FROM.
1 Structured Query Language (SQL). 2 Contents SQL – I SQL – II SQL – III SQL – IV.
Instructor: Dema Alorini Database Fundamentals IS 422 Section: 7|1.
Lecture2: Database Environment Prepared by L. Nouf Almujally 1 Ref. Chapter2 Lecture2.
Nitin Singh/AAO RTI ALLAHABAD 1 SQL Nitin Singh/AAO RTI ALLAHABAD 2 OBJECTIVES §What is SQL? §Types of SQL commands and their function §Query §Index.
6 1 Lecture 8: Introduction to Structured Query Language (SQL) J. S. Chou, P.E., Ph.D.
4a. Structured Query Language - SELECT Statement Lingma Acheson Department of Computer and Information Science IUPUI CSCI N207 Data Analysis with Spreadsheets.
Prepared by The Smartpath Information Systems
Indexes and Views Unit 7.
PowerBuilder Online Courses - by Prasad Bodepudi Database Painter Primary & Foreign Keys Extended Attributes PowerBuilder System Tables Database Profiles.
SQL.. AN OVERVIEW lecture3 1. Overview of SQL 2  Query: allow questions to be asked of the data and display only the information required. It can include.
(SQL - Structured Query Language)
Learningcomputer.com SQL Server 2008 –Views, Functions and Stored Procedures.
Understand Tables and How to Create Them Database Administration Fundamentals LESSON 2.2.
CS 111 – Nov. 8 Databases Database Management Systems (DBMS) Structured Query Language (SQL) Commitment –Please review sections 9.1 – 9.2.
Selecting Data Database Administration Fundamentals LESSON 3.1a.
Chapter 6 Virtual Private Databases
SQL Query Analyzer. Graphical tool that allows you to:  Create queries and other SQL scripts and execute them against SQL Server databases. (Query window)
Lesson 4: Querying a Database. 2 Learning Objectives After studying this lesson, you will be able to:  Create, save, and run select queries  Set query.
Manipulating Data Lesson 3. Objectives Queries The SELECT query to retrieve or extract data from one table, how to retrieve or extract data by using.
SQL Introduction to database and SQL. Chapter 1: Databases and Database Users 6 Introduction to Databases Databases touch all aspects of our lives. Examples:
7 1 Database Systems: Design, Implementation, & Management, 7 th Edition, Rob & Coronel 7.6 Advanced Select Queries SQL provides useful functions that.
Create Views Using a Graphical Designer Database Administration Fundamentals LESSON 2.3b.
Understand Data Definition Language (DDL) Database Administration Fundamentals LESSON 1.4.
Create Stored Procedures and Functions Database Management Fundamentals LESSON 2.4.
Select Complex Queries Database Management Fundamentals LESSON 3.1b.
Data Resource Management Data Concepts Database Management Types of Databases Chapter 5 McGraw-Hill/Irwin Copyright © 2007 by The McGraw-Hill Companies,
Agenda for Today  DATABASE Definition What is DBMS? Types Of Database Most Popular Primary Database  SQL Definition What is SQL Server? Versions Of SQL.
Understanding Core Database Concepts Lesson 1. Objectives.
SQL Introduction SQL stands for “Structured Query Language” and can be pronounced as “SQL” or “sequel – (Structured English.
Understand Data Manipulation Language (DML)
Fundamentals & Ethics of Information Systems IS 201
Created by Kamila zhakupova
Understand Data Manipulation Language (DML)
Client Access, Queries, Stored Procedures, JDBC
Structured Query Language
SQL .. An overview lecture3.
Ch 3 Synonym.
Databases Continued 10/18/05.
SQLPLUS: Oracle SQL Interface
Views for Excel and Reporting
SQL-Views and External Schemas
Understanding Core Database Concepts
Manipulating Data Lesson 3.
Presentation transcript:

Create Views Using T-SQL Database Administration Fundamentals LESSON 2.3a

Database Administration Fundamentals LESSON 2.3a Lesson Overview In this lesson, you will learn:  What is T-SQL?  How is T-SQL different from other graphical designers?  What is a view?  What advantages do views have?  How is a view created?

Database Administration Fundamentals LESSON 2.3a What is T-SQL?  Transact-SQL (T-SQL) is an extension of the SQL database programming language.  T-SQL is a sophisticated SQL dialect loaded with features in addition to what is defined in the ANSI SQL-92 standard.

Database Administration Fundamentals LESSON 2.3a How is T-SQL different from graphical designers?  T-SQL uses a command-line interface for working with the database rather than a graphical interface.  It is a procedural programming language.  Graphical designers (such as Microsoft Access) are object- oriented and use a drag-and-drop interface, not a command- line interface. Graphical designers will be explored in detail in Review Lesson 2.3b.

Database Administration Fundamentals LESSON 2.3a What is a view?  In relational database management systems (RDMSs), a logical table is created through the specification of one or more relational operations on one or more tables.  A view is a virtual table that displays the data from a selected table or tables.  Example:  A user of the database should see only virtual tables. Only the database manager should see the real tables.

Database Administration Fundamentals LESSON 2.3a What advantages do views have?  A view can be thought of as a stored query.  The data accessible through a view is not stored in the database as a distinct object.  What is stored in the database is a SELECT statement. The result set of the SELECT statement forms the virtual table.  The virtual table is accessed by referencing the view name in T-SQL statements, as follows: SELECT * from Where

Database Administration Fundamentals LESSON 2.3a How can views be used?  A view can be used to:  — Restrict a user to specific rows in a table. Example: you can allow an employee to see only the rows recording his or her work in a labor-tracking table.  — Restrict a user to specific columns. Example: you can allow employees who do not work in payroll to see the name, office, work phone, and department columns, but not any columns with salary or personal information.  — Restrict information rather than supplying details. Example: you can present the sum of a column, or the maximum or minimum value from a column.

Database Administration Fundamentals LESSON 2.3a How is a view created? CREATE VIEW AS SELECT FROM Example: CREATE VIEW seniors AS SELECT student_id, student_name FROM enrolled_students  The above code creates a virtual table called seniors that holds the data Student Id and Student Name. The data was pulled from the table enrolled_students.

Database Administration Fundamentals LESSON 2.3a Create a view with conditions To create a view, use the following command: CREATE VIEW AS SELECT FROM WHERE condition Example: this code creates a virtual table that contains only girls. CREATE VIEW seniors AS SELECT student_id, student_name FROM enrolled_students WHERE Gender = “F”

Database Administration Fundamentals LESSON 2.3a Quiz Write the code to create each view, using only one conditional per view. 1. Create a view from the table named medical_school_students that will select all the male medical students. 2. Create a view from the table named employees_skills that will select all employees that have first aid training. 3. Create a view from the table named enrolled_students that will select all students over 62.