180 likes | 370 Views
And Franchise Colleges. HSQ - DATABASES & SQL. 2 MS SQL Server Overview. By MANSHA NAWAZ. OVERVIEW. Client Server Architecture What is SQL? MS SQL Server V MS Access Creating an SQL Server Database Enterprise Manager Example SQL Enterprise Manager Resources Query Analyzer Example
E N D
And Franchise Colleges HSQ - DATABASES & SQL 2 MS SQL Server Overview • By MANSHA NAWAZ MS SQL Overview
OVERVIEW • Client Server Architecture • What is SQL? • MS SQL Server V MS Access • Creating an SQL Server Database • Enterprise Manager Example • SQL Enterprise Manager Resources • Query Analyzer Example • SQL in Query Analyzer • SQL Query Analyser Resources • Additional SQL Resources MS SQL Overview
Department File-Servers User Workstation User Workstation Corporate Servers Operator Workstation Client/Server Architecture • Server provides services for the Clients which are responsible for interacting with the users (Input/Output) • Server is responsible for performing a service (e.g. transaction) and guaranteeing the integrity of the data • Well suited for distributed systems handling large amounts of data MS SQL Overview
Database Development Systems Analysis & Design DFD DataStores, DataFlows and Data Dictionary DATA MODEL TABLE SET NF E-R Model Database Management System (DBMS) PHYSICAL VIEW OF DATA TABLES (computer view)) LOGICAL VIEW OF DATA FORMS (user view) WEB DEVELOPMENT Database connectivity via websites www .net technology Macromedia Dreamweaver MS Visual Studio CLIENT DB Development Database connectivity via desktop DBMS such as MS Access Program Development Database connectivity via programming languages such as MS Visual Basic Client Area of Interest Server Area of Interest MS SQL Overview
What is SQL? • Structured Query Language • It is the standard language for managing a database • Creating, • Accessing • Searching • Modifying • Many different Systems depending on maker of software: • Oracle • Microsoft SQL Server • MS Access • Sybase etc. • Initially we will examine SQL under MS Access • non-standard SQL • In the main we use MS SQL Server 2000 • standard SQL Some Variations in symbols ACCESS SQL “ ‘ # % MS SQL Overview
MS SQL Server V MS Access • MS Access is Desktop based • Small, low-traffic database systems • Small, low-traffic web sites requiring database connectivity. • Cannot handle heavy traffic from multiple users. • MS SQL Server is a server based database. • Multi User – Multi Platform Systems • Large, high volume traffic database systems • Server holds database. Workstation provides access. • For web or database systems if the access traffic is likely to generate more than 20 concurrent database hits at a time, it's time to move to a database server • Generally, database servers like MS SQL Server are the way to go for database or web/database systems • Many and wide ranging user base for system • Additional Security and Login features • MySQL (free sql database used for connectivity to Websites via PHP). MS SQL Overview
MS SQL SERVER 2005MS SQL SERVER 2005 – STUDENT EDITION from MSDNAAMS SQL SERVER 2008 ** newMS SQL SERVER 2008 STUDENT EDITION from MSDNAA installation guide – similar to 2005 editionAll lecture notes are in version 2005The 2008 interface is similar if not the same. MS SQL Overview
MSDN – MS SQL Server 2005 Online Videoshttp://msdn2.microsoft.com/en-us/express/aa718391.aspx • Learning Resources - Video Series: SQL Server 2005 Express Edition for Beginners • Getting Started with SQL Server Express • This video series is designed specifically for SQL Server beginners—individuals who are interested in learning the basics of how to create, manage, and connect to SQL Server Express databases. Whether you’re just a beginner or somewhat familiar with databases, these video lessons will help you get better acquainted with SQL Server 2005 Express. • The series includes almost 9 hours of video-based instruction that walks SQL Server beginners through the steps of learning about SQL Server databases to actually connecting a SQL Server database to a Web application. Select your starting point below based on your skill set. • Introduction • Learning Video 1: What is a database? • Designing Tables • Learning Video 2: Understanding Database Tables and Records • Learning Video 3: More about Column Data Types and Other Properties • Learning Video 4: Designing Relational Database Tables • Database Functions • Learning Video 5: Manipulating Database Data • Learning Video 6: More Structured Query Language • Learning Video 12: Creating and Using Stored Procedures • Learning Video 13: Enabling Full-Text Search in your Text Data • Creating and Using Reports • Learning Video 10: Getting Started with Reporting Services • Learning Video 11: Embedding, Packaging and Deploying SQL Server Express Reporting Services • Database Security • Learning Video 7: Understanding Security and Network Connectivity • Database Management • Learning Video 9: Using SQL Server Management Studio Express • Publishing to the Web • Learning Video 8: Connecting your Web Application to SQL Server 2005 Express Edition MS SQL Overview
MS SQL Server 2005 MS SQL Overview
Management Studio Graphical User Interface Click Databases Note additional server option MS SQL Overview
Note SUMMARY tag. Available from VIEW menu. Expand databases by clicking + MS SQL Overview
Management Studio Graphical User Interface (GUI) - develop and draw ER model to implement database • Use the GUI to develop your ER model. • Add, Delete and Modify Tables, Fields and Relationships (links). • SQL Script Code automatically generated. • Also develop Views, Queries Reports etc Library ERD MS SQL Overview
Management Studio Scripting User Interface SUI - develop and write SQL Code to implement database • The most popular, and now standard, language for manipulating tables in a relational database is SQL. • SQL, often known as a query language, is a combined DDL, DML and DCL used with relational databases. • Data Definition Language (DDL) • is used to specify the data in a database. • The DDL statements define database objects, eg databases, tables, views, indexes, users, constraints, user-defined data types: CREATE, DROP, ALTER • Data Manipulation Language (DML) • is used to access the data in a database. • The DML statements manipulate data: SELECT, INSERT, DELETE, UPDATE • Data Control Language (DCL) • is used to control access to the data in a database. • The DCL statements control access to data: GRANT, DENY, REVOKE MS SQL Overview
SQL Query Code Example USE Restaurants GO -- Create the Widgets table in Restaurants CREATE TABLE RestaurantTable ( RestaurantId INT NOT NULL PRIMARY KEY IDENTITY(1,1), RestaurantName VARCHAR(50) NOT NULL, Rating SMALLINT DEFAULT 3, AvgMealPrice MONEY NOT NULL, ReservationReqd BIT NOT NULL DEFAULT 0 ) GO USE MASTER GO -- If the database already exists, drop it IF EXISTS(SELECT * FROM sysdatabases WHERE name='Restaurants') DROP DATABASE Restaurants GO -- Create the Restaurants database CREATE DATABASE Restaurants GO MS SQL Overview
SQL Server Object Names • Standard Identifiers • Can contain from one to 128 characters, including letters, symbols (_ @ or #) and numbers. • No embedded spaces are allowed. • The first character must be alphabetic. • A name beginning with @ denotes a local variable or parameter. • A name beginning with # denotes a temporary table or procedure. • A name beginning with ## denotes a global temporary object. • NB: Names for temporary objects shouldn’t exceed 116 characters including # or ## as SQL Server gives them an internal numeric suffix. • Delimited Identifiers • Do not comply with the rules for standard identifiers and must, therefore, always be delimited. • You can use delimited identifiers when: • Names contain embedded spaces. • Reserved words are used for object names or portions of object names. • You must enclose delimited identifiers in square brackets or quotation marks when you use them in Transact-SQL statements, eg: • SELECT * FROM [Blanks In Table Name] • SELECT * FROM “Blanks In Table Name” • NB:You can always use bracketed delimiters but can only use quotation marks if the SET QUOTED_IDENTIFIER option is on. MS SQL Overview
Additional SQL Resources on the SQL Website. MS SQL Overview
FURTHER READING • Review the attached set of SQL notes over the next four weeks to reinforce your SQL skills. • Data Models are converted to schemas which are readable by the database management system. • Notation standardised through SQL and XML • Schemas describe data. • Described as tables (relations) for relational databases. • Definition of Columns of tables based on domains (sets of valid values). • Metadata describes data. Schemas form part of the metadata for a system. MS SQL Overview
End of Lecture MS SQL Overview