Agenda for Class 2/20/2014 Introduce Microsoft’s SQL Server database management system. Use the lab to discuss how to CREATE, DROP and populate (INSERT)

Slides:



Advertisements
Similar presentations
Stored procedures and views You can see definitions for stored procedures and views in the demo databases but you can’t change them. For views, expand.
Advertisements

1 SQL Server Management Studio SQL DDL CREATE TABLE Constraints ALTER TABLE DROP TABLE The GUI way Steen Jensen, autumn 2013.
Brian Alderman | MCT, CEO / Founder of MicroTechPoint Pete Harris | Microsoft Senior Content Publisher.
What is MySQL? MySQL is a relational database management system (A relational database stores data in separate tables rather than putting all the data.
Agenda for Class 2/16/2012 Introduce Microsoft’s SQL Server database management system. Use the lab to discuss how to CREATE, DROP and populate (INSERT)
 Review HW #4  Answer questions about Microsoft Visio  Introduce SQL  Introduce SQL Server 2008 environment for programming SQL  Will meet in AB208.
Introduction to Structured Query Language (SQL)
DT211 Stage 2 Databases Lab 1. Get to know SQL Server SQL server has 2 parts: –A client, running on your machine, in the lab. You access the database.
Concepts of Database Management Sixth Edition
A Guide to MySQL 7. 2 Objectives Understand, define, and drop views Recognize the benefits of using views Use a view to update data Grant and revoke users’
Introduction to Structured Query Language (SQL)
Concepts of Database Management Sixth Edition
Chapter 7 Managing Data Sources. ASP.NET 2.0, Third Edition2.
PHP and SQL Server: Queries IST2101. Three-Tier Architecture Three-tier architecture means that the Web server and the DBMS are on separate servers IST2102.
DAT702.  Standard Query Language  Ability to access and manipulate databases ◦ Retrieve data ◦ Insert, delete, update records ◦ Create and set permissions.
Your Oracle Account UserName is the same as your UWP username Followed Not case sensitive Initial Password: UWPstudent Password is case sensitive.
Ceng 356-Lab1. Objectives After completing this lesson, you should be able to do the following: Get Familiar with the development environment List the.
1 Working with MS SQL Server II. 2 The sqlcmd Utility Command line utility for MS SQL Server databases. Previous version called osql Available on classroom.
Overview What is SQL Server? Creating databases Administration Security Backup.
A Guide to SQL, Eighth Edition Chapter Three Creating Tables.
Session 5: Working with MySQL iNET Academy Open Source Web Development.
Microsoft Azure Introduction ISYS 512. Microsoft Azure Microsoft Azure is a cloud.
ASP.NET Programming with C# and SQL Server First Edition
15 Structured Query Language (SQL). 2 Objectives After completing this section, you should be able to: Understand Structured Query Language (SQL) and.
Concepts of Database Management Seventh Edition
Chapter 4 The Relational Model 3: Advanced Topics Concepts of Database Management Seventh Edition.
IPC144 Introduction to Programming Using C Week 1 – Lesson 2
HAP 709 – Healthcare Databases SQL Data Manipulation Language (DML) Updated Fall, 2009.
CS 3630 Database Design and Implementation. Your Oracle Account UserName is the same as your UWP username Followed Not case sensitive Initial.
CPSC 203 Introduction to Computers Lab 23 By Jie Gao.
Introduction to SEQUEL. What is SEQUEL? Acronym for Structural English Query Language Acronym for Structural English Query Language Standard language.
1 Working with MS SQL Server Textbook Chapter 14.
© FPT SOFTWARE – TRAINING MATERIAL – Internal use 04e-BM/NS/HDCV/FSOFT v2/3 Working with MSSQL Server Code:G0-C# Version: 1.0 Author: Pham Trung Hai CTD.
NMED 3850 A Advanced Online Design January 12, 2010 V. Mahadevan.
Concepts of Database Management Seventh Edition
7 1 Chapter 7 Introduction to Structured Query Language (SQL) Database Systems: Design, Implementation, and Management, Seventh Edition, Rob and Coronel.
Chapter 5 MYSQL Database. Introduction to MYSQL MySQL is the world's most popular open-source database. Open source means that the source code, the programming.
Oracle 11g DATABASE DEVELOPMENT LAB1. Introduction  Oracle 11g Database:-  Oracle 11g database is designed for some features, which helps to the organizations.
1 Chapter Overview Understanding User Accounts Planning New User Accounts Creating, Modifying, and Deleting User Accounts Setting Properties for User Accounts.
6 1 Lecture 8: Introduction to Structured Query Language (SQL) J. S. Chou, P.E., Ph.D.
® Microsoft Office 2013 Access Creating a Database.
Agenda for Class 9/25/2012 Introduce Microsoft’s SQL Server database management system. Use the lab to discuss how to CREATE, DROP and populate (INSERT)
A Guide to MySQL 3. 2 Introduction  Structured Query Language (SQL): Popular and widely used language for retrieving and manipulating database data Developed.
Unit 5 Microsoft SQL Server and MySQL. Key Concepts DBMS variations SQL Server features SQL Server Management Studio MySQL features Scripts Queries Database.
1 Database Systems Introduction to Microsoft Access Part 2.
Chapter 9 Constraints. Chapter Objectives  Explain the purpose of constraints in a table  Distinguish among PRIMARY KEY, FOREIGN KEY, UNIQUE, CHECK,
Oracle 11g: SQL Chapter 4 Constraints.
Copyright  Oracle Corporation, All rights reserved. Introduction.
Chapter 4 Constraints Oracle 10g: SQL. Oracle 10g: SQL 2 Objectives Explain the purpose of constraints in a table Distinguish among PRIMARY KEY, FOREIGN.
© Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Outline 25.1 Test-Driving the ATM Application 25.2.
Agenda for Class 2/02/2006 Finish discussing constraints generated with the CREATE TABLE statement. Discuss DROP statement. Discuss INSERT, COMMIT, DELETE,
Database Access Control IST2101. Why Implementing User Authentication? Remove a lot of redundancies in duplicate inputs of database information – Your.
Session 1 Module 1: Introduction to Data Integrity
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.
Oracle 11g: SQL Chapter 7 User Creation and Management.
Starting with Oracle SQL Plus. Today in the lab… Connect to SQL Plus – your schema. Set up two tables. Find the tables in the catalog. Insert four rows.
SQL Introduction to database and SQL. Chapter 1: Databases and Database Users 6 Introduction to Databases Databases touch all aspects of our lives. Examples:
LM 5 Introduction to SQL MISM 4135 Instructor: Dr. Lei Li.
Software-Projekt 2008 Seminarvortrag“Short tutorial of MySql“ Wei Chen Verena Honsel.
1 Section 1 - Introduction to SQL u SQL is an abbreviation for Structured Query Language. u It is generally pronounced “Sequel” u SQL is a unified language.
Agenda for Today  DATABASE Definition What is DBMS? Types Of Database Most Popular Primary Database  SQL Definition What is SQL Server? Versions Of SQL.
Data Integrity & Indexes / Session 1/ 1 of 37 Session 1 Module 1: Introduction to Data Integrity Module 2: Introduction to Indexes.
Understanding Core Database Concepts Lesson 1. Objectives.
Controlling User Access
ATS Application Programming: Java Programming
Database application MySQL Database and PhpMyAdmin
ORACLE SQL Developer & SQLPLUS Statements
SQL .. An overview lecture3.
Understanding Core Database Concepts
Ch 1 .Installing and configuring SQL Server 2005
Presentation transcript:

Agenda for Class 2/20/2014 Introduce Microsoft’s SQL Server database management system. Use the lab to discuss how to CREATE, DROP and populate (INSERT) tables. Introduce SELECT statement. We will review the basic concepts together and create 1 table as a class. Then you will finish the rest of the lab at your own speed during class.

Accessing SQL Server Login to COB server (use your netID). Accessing from COB labs: –Execute Microsoft SQL Server Management Studio. Accessing from home: –Execute Remote Desktop Connection. –Login to the student server called sts.coba.unr.edu Use your netID as the User name and password. When not in the COB labs, your netID for Windows authentication is UNR\netID. UNR is referred to as the “domain” for our student server. –Execute Microsoft SQL Server Management Studio.

Logging into the class server for SQL Server After executing SQL Server Management Studio, either directly when in the COB labs, or through remote desktop when not in the COB labs, you must login to our class server. –Server name is ISSQL\Students Use Windows authentication for all work on SQL Server.

SQL Server Management Studio Object Explorer New Query editor Options File Tabs Difference between database object and SQL code Accessing files from the k: or u: drives Saving SQL code to/from a separate file

SQL statements start with a command, and then include few or many modifiers/extensions for the command. SQL statements are not case sensitive. The data stored in a data base ARE case sensitive. SQL statements can span more than one physical line; it is a free form language. SQL keywords cannot be abbreviated or split across lines. 5 Guidelines for writing SQL

Keywords and/or main clauses are typically placed on separate lines. Tabs and indentation are used to enhance readability. Keywords are typically aligned in the first column. Keywords are usually capitalized. Data are usually in lowercase or a combination of uppercase and lowercase. Comments are included sparingly, but usefully. 6 Much tradition in SQL code

Class Exercise Database Referential integrity: Table constraint. When inserting data in the child table, the DBMS checks to see whether a related row exists in the parent table. This constraint helps improve the accuracy of data input into the database.

Let’s create a small table Click on the “new query” button. This is “task #1” on the exercise document. Type the following: CREATE TABLE xtblVendor (VendorIDchar(4)primary key, VendorNamevarchar(30), FirstBuyDatedatetime); Click on the “Execute” button.

Deleting a table Cannot have more than one data object with the same name. Must delete data objects before re-creating them. SQL Statement is: DROP TABLE xtblVendor; Let’s try and drop the table named xtblVendor. Keep the current query tab open, and open another “new query” tab. Drop the table. This is task #2 on the exercise. General information: Must delete objects in the order of referential integrity constraints.

Create a named constraint Constraints can be “named” in SQL for easier future reference. This is task #3 on the exercise. CREATE TABLE xtblVendor (VendorIDchar(4), VendorNamevarchar(30), FirstBuyDatedatetime CONSTRAINT pkVendor PRIMARY KEY (vendorID)); Constraint names may be referenced in the future if they need to be changed (altered). Easier to reference a name that you create, rather than one that SQL Server creates for you.

SQL INSERT Statement Used to “populate” a table with data. Used to enter one row of data. Character data and dates must be entered surrounded by single quotes. Dates can be entered using a variety of formats: –‘20-feb-2014’ –‘02/20/2014’ –’ ’ Dates are stored as integers; not with “date-like” formatting.

Let’s put data into that table Click on the “new query” button. Type the SQL statements on Task #4 on the exercise document. Each command will produce one row in the table called “xtblVendor”.

Let’s look at the data Click on the “new query” button. The SQL statement below is task #5 on the exercise document. SELECT * FROMxtblVendor;

Examples of Retrieving Data from a Table SELECT* FROM xtblVendor; SELECT VendorID, VendorName FROM xtblVendor WHERE VendorID = ‘0062’; The * means retrieve all columns. The FROM statement, without a WHERE statement, means retrieve all rows.

Now create the other three tables in the sample ERD Do tasks #6 through #10 on the exercise document.

Sharing tables with your team You are the owner of your database. You have the right to GRANT access to your database. There is a handout on the class website discussing how to change permissions, and we will discuss it next class. Best practice for right now: –Create and populate the tables in each group member’s database. The data for HW#5-8 is relatively static, so it will lessen the complexity of the assignments if everyone has direct access to the tables. –Each class member should get experience creating and populating tables in his/her own database, even when working as part of a team.