Insert, Update and Delete in Access

Total Page:16

File Type:pdf, Size:1020Kb

Insert, Update and Delete in Access

Mansha Nawaz MS SQL SERVER 2005 / 2008 Chapter i: Study Guide

MS SQL SERVER 2005 / 2008 Introduction Guide Click here for Study Guide (pg iv)

Mansha Nawaz MS SQL SERVER 2005 / 2008 Chapter i: Study Guide i Mansha Nawaz MS SQL SERVER 2005 / 2008 Chapter i: Study Guide

1. Introduction to Server Databases

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

Department User Workstation File-Servers

Corporate Servers User Workstation Operator Workstation

Supplement 01 (a) Database-Introduction-1

SQL Server is one of the most popular and advanced database systems currently available. SQL Server is provided by Microsoft. Microsoft SQL Server is sometimes called as "Sequel Server". It can be managed using Structured Query Language. While MS Access is meant for small applications, SQL Server supports large applications with millions of users or huge databases. SQL Server is much more powerful than MS Access and provides several other advanced features and much better security. SQL Server is compatible with MS Access. You can easily import/export data between these two.

SQL Server is a Relational database where data is stored and retrieved very efficiently.

Mansha Nawaz MS SQL SERVER 2005 / 2008 Chapter i: Study Guide ii Mansha Nawaz MS SQL SERVER 2005 / 2008 Chapter i: Study Guide

2. Compare SQL Server and MS Access This helps you decide whether to choose MS Access or MS SQL Server for your application.

a. Advantages of MS Access MS Access is a light weight database managements system. Also, it provides it's own designer so that you can generate reports and simple windows applications without using another programming environment. It is easy to deploy an MS Access database. Just copy the .MDB file to appropriate location and you are done. There is no database attach/detach process. b. Advantage of Server Database - MS SQL Server

All advanced database management systems include some kind of service applications as part of the database system. For example, to use the SQL Server database, you must have an application called "SQL Server Engine" running on the computer. This application is a windows service (a hidden application that will start automatically when your computer starts and keep running always).

Your program (software) which need to access the database will not access the database file directly. Instead, your program will communicate with the database service application. It is the responsibility of this service to communicate with the database file and execute your commands.

When you install SQL Server on your computer, the SQL Server service will be automatically installed on your computer. When you write code to access database, you just write the ADO.NET code using C#, VB.NET etc. The .NET Framework will execute your ADO.NET code to communicate with the database server and database server will communicate with the database file to execute. All these happens without your knowledge. All you do is, write ADO.NET code to execute queries and you will get the results back.

To make your ADO.NET code work, the database service must be running. If somebody stop the service, your code will fail. In case of file based database systems like MS Access or FoxPro, there is no database service involved. Your code will directly communicate with the database file. c. Which one to choose - MS Access or SQL Server ? MS Access is ideal only for applications that require very small databases. Even though the maximum database size limit for MS Access is 1 GB, the performance becomes poor if the size grows more than few hundred MBs.

If you expect your application database to grow more than 100 MB in future, you should consider using SQL Server. It may not be an easy task to migrate to SQL Server later. Eeven though SQL Server allow you to import your MS Access database to SQL Server, you will have to do lot of code changes to take advantage of the SQL Server features.

There will be major performance difference between MS Access and SQL Server. If you are writing a critical application where performance is important, then you must consider SQL Server instead of MS Access.

The new SQL Server 2005 / 2008 Express is a free version and allow copy/deploy feature. You can copy the database file and attach on the fly. It is a good idea to use SQL Server 2005 / 2008 Express if you cannot afford to purchase SQL Server license. It has much better peformance and features compared to MS Access.

The bottom line is, choose MS Access only for small and non critical applications.

Mansha Nawaz MS SQL SERVER 2005 / 2008 Chapter i: Study Guideiii Mansha Nawaz MS SQL SERVER 2005 / 2008 Chapter i: Study Guide

MS SQL Server 2005 / 2008 – Study Guide

extracted from the HSQ Module Guide “The DB & SQL web site contains additional support, guidance and model solutions material. It is anticipated that the DB & SQL web site will provide you with all the material and help you need. It is important you try and review all the guides or exercises. Tackle the guides or exercises of interest in the practical session and if need be to finish off as home study. For additional support you may also work on solutions in small peer groups. If you are struggling consult the model solution provided, talk to fellow students or consult your tutor. It is important that you do not fall behind with the practical work as the skills developed are essential for your ICA and your final year project.” a. MS SQL Server 2005 / 2008 – Practical Guide

Work your way through the SQL guides and then tackle the proceeding case studies. You may work in small groups in the lab to complete the guides. All are available on Mansha Nawaz staff page for Databases & SQL. The MSDN MS SQL Server 2005 / 2008 Video was produced under an earlier beta release.

The MSDN SQL 2005 / 2008 Learning Resource consists of 8 video lessons to demonstrate the use of MS SQL Server 2005 / 2008. Some of the videos use MS Visual Studio (which includes MS SQL Server 2005 / 2008) as the development environment. Visual Studio provides the front-end WEB and a back-end SQL Server DATABASE.

WEEKS MS SQL Server 2005 / 2008 Practical Guide

1 a. SQL Practical Guide Overview 1 b. MS SQL Server 2005 / 2008 Introduction 1 c. Student version installation guide 1 d. Express version installation guide 1 e. MS Visual Web Development installation guide 2 f. MSDN - MS SQL Server 2005 / 2008 Video Resources 1-6 1. MS SQL Server 2005 / 2008 Introduction (new) 2 2. Management Studio Guide 3 3. Create a Database via ERD (student) 3 4. Create a Database via Tables (unispares) 3 5. Create a Database via SQL Script Code (student1) 3 6. SQL Query Introduction (customer) 4 7. MS Access <-> MS SQL Server (library) 4 8. MS Access <-> MS SQL DDL & DML (library) 5 9. MS SQL - Detach and Attach databases b. Watch the MSDN - MS SQL Server 2005 / 2008 Video Resources

Mansha Nawaz MS SQL SERVER 2005 / 2008 Chapter i: Study Guideiv Mansha Nawaz MS SQL SERVER 2005 / 2008 Chapter i: Study Guide c. Library of free Data Models (ERDs):

Review the library of free data models. You will be developing the skills to implement these data models in MS SQL Server 2005 / 2008. These data models will be useful for developing database/web systems. Consider merging some of the models for a complete system solution. You will find these useful for either your ICA or project work. Resources VIII – Free Data Models http://www.databaseanswers.org/data_models/index.htm

d. ASCENT ERD Samples: There are also some Entity Relationship Diagram (ERD) Samples developed within ASCENT S/W. Please consult the following Ascent Resources. Please note your ERDs can now be developed within MS SQL Server 2005 / 2008 – Management Studio development environment. Ascent Resources Ascent S/W and ERD Solutions Installing Ascent At Home Using Ascent - ER Modeling

Mansha Nawaz MS SQL SERVER 2005 / 2008 Chapter i: Study Guide v Mansha Nawaz MS SQL SERVER 2005 / 2008 Chapter i: Study Guide e. SQL CASE STUDIES:

Work your way through the SQL Case Studies provided as links on the next page.

Sample Solutions and SQL Code are provided.

The sample databases (*.Log.zip) files can be loaded using the command attach & detach commands.

9. MS SQL - Detach and Attach databases

Alternatively once you create the database in Management Studio you can load and execute the SQL Script Code provided to create tables, views, etc.

f. SUPPORT: SQL DDL & DML Lecture Material The following online SQL lecture material provides an overview of SQL Data Definition Language (DDL) and SQL Data Manipulation Language) DML code. You may need to refer to these when reviewing any SQL code syntax provided in the above case studies. They will assist in tackling the SQL guides & case studies and are provided as part of the Database & SQL lecture booklet.

Scm-Intranet Introduction to SQL Guides

powerpoint SQL Overview

Word SQL Concepts

Further Guides … Key Relational and SQL Key Relational and SQL Key Relational and SQL SQL DDL & DDM 1 Concepts (part 1 of 3) Concepts (part 2 of 3) Concepts (part 3 of 3)

SQL DDL & DDM 1 SQL_Data_Definition Domains Metadata XML

SQL Data Definition SQL DDL & DDM 1 SQL Sub Queries SQL Groups Views

MS SQL Server Samples & Case Studies

See Next Page

Mansha Nawaz MS SQL SERVER 2005 / 2008 Chapter i: Study Guidevi DATABASE CASE STUDIES and SQL DATABASE RESOURCES

MS SQL Server Resources > SQL CODE Guide > UoT SQL User Guide Overview Concepts Either ATTACH the SQL Database (*._Log.Zip file) or Create the database - before executing the SQL script code

SQL Script SQL Script SQL Script SQL Script - View, No SQL CASE STUDIES SQL Databases Constraints & Create DROP INSERT Triggers 1 students1 (SQL 2005 / 2008) students1_Log.zip students1 students1 students1view student1 view 2 students2.constraint 2 students2 (SQL2005 / 2008) students2_Log.zip students2 students2 s students2.constraint 3 students3 (SQL 2005 / 2008) students2_Log.zip students2 students2 s 4 Jobsv2000 (SQL 2005 / 2008) jobsv2000_Log.zip Jobsv2000 Jobsv2000 Jobsv2000 5 dressmaker (SQL 2005 / 2008) dressmaker_Log.zip dressmaker dressmaker dressmaker 6 Musician SQL 2005 / 2008) musician_Log.zip musician musician musician 7 carhire (SQL 2005 / 2008) carhire_Log carhire contractview carhiretrigger 8 unispares (SQL2005 / 2008) unispares_Log.zip Unispares unispares.PO unispares.Invoice 9 bus (2205) bus_Log BUS 10 RHA Example 1 RHA rha.sql rha.delete 11 RHA Example 2 RHA 12 Quickhire (case study) in case study

CASE STUDIES (options for ICA) More SQL Databases 1 Car Services (CS) librarySQL.zip 2 Doctors Surgery northwnd.zip 3 Ambulance Service (CS) pubs_log.zip 4 Eurovan (Case Study) horses4courses_Log.zip 5 EECS (Case Study) 6 DIGITAL (Case Study) 7 Shermac (Case Study) 8 WAC (Case Study)

DATABASE CASE STUDIES and SQL DATABASE RESOURCES iii

Recommended publications