SCHOOL OF COMPUTING HND YEAR 2 SOFTWARE DEVELOPMENT. Databases and SQL ICA. Paul Nicks (f )
|
|
- Scott Fitzgerald
- 5 years ago
- Views:
Transcription
1 SCHOOL OF COMPUTING HND YEAR 2 SOFTWARE DEVELOPMENT Databases and SQL ICA Paul Nicks (f ) January 2008
2 CONTENTS 1 INTRODUCTION Overview Identified Constraints Deliverables 5 2 ENTITY RELATIONSHIP DIAGRAM 7 3 TABLES Contract Customer Employee Fabrication Fabricator Flange Batch Flange Type Flange Unit Material Material Batch Observation Pipe Batch Pipe Length Pipe Type Rod Batch Rod Type Test Operative Ultrasound Unit Order Weld Weld Cert Welder Weld Test Weld Type X Ray 20 4 SQL CODE The SELECT Command (DML) 23 ii
3 4.2 Adding a Record to a Table (DML) Deleting a Record in a Table (DML) Updating a Record (DML) Ordering the records within a table (DML) Creating a Table (DDL) Dropping a Table (DDL) Creating Views (DDL) 31 5 DETACH AND ATTACHING A DATABASE Detaching a Database Attaching a Database 34 6 CRITICAL REVIEW Review of Report Review of Introduction Review of ERD Review of Database Implementation Review of SQL Code Review of Personal developement 35 7 REFERENCES APPICES Database Scrip File 37 iii
4 1. INTRODUCTION 1.1 Overview A company called Myson Pollock Fabrications have requested a Database system to manage their company s information. Myson Pollock produce Fabrications consisting of Pipes and Flanges for the chemicals industry and mainly deal with Oil Companies. In association with these Fabrications there must be regular testing of Fabrications and records of all staff, designs, materials and welding used in the production must be kept and be traceable. The Database must also hold details of suppliers of the Materials and any Purchase Orders related to them. Customer and contract details must also be stored. 1.2 Identified Constraints Due to the nature of what will need to be store and retrieved, there are several constraints placed on the database system. Because of Safety regulations imposed on the company the system must record data so that everything produced must have all aspects of its production and testing traceable. Constraints imposed are: In production a Pipe and Flange batch must come from a single batch of material. Also welding rods used on a batch must come from the same material batch. In production a Weld must be done by a member of Staff who has a current certificate for that type of weld. In production a Fabricator works with a single rig and its number and location is to be recorded with the member of staff In Testing and Quality Assurance a Tester must have details recorded for Last Sight Test and number of X ray tests carried out over last 12 months. 1.3 Deliverables Through the creation of the required system I hope to improve my knowledge of SQL and be able to produce a working model. On completion of this project I hope to have achieved the following: A full ERD of the proposed Database System. Create and populate all tables with some sample data 5
5 Create and test SQL Code for Queries and commands. Due to the size of the system and time constraints I will develop all the Tables and populate with sample code but will only give some DDL and DML examples. 6
6 2. ENTITY RELATIONSHIP DIAGRAM Below is the proposed Database System for Myson Pollock Fabrications. The structure and the Contents of the Tables have been derived from the case study requirements. With some of the Tables the Additional Support Material was used to help construct them. 7
7 3. TABLES Each of the following tables has been created from the information given on the Case Study. I have also added where I deemed necessary extra columns to enable better functionality and Data Integrity. Overall I have created 25 Tables to obtain the required system. The Screenshots below will show the design of each table, Primary / Foreign keys used and the table with sample data inserted. 3.1 Contract Table This Table will store all Contract information and be the creation point for any Unit orders. All Columns must be completed (No NULLS allowed) Primary Key: Foreign Keys: ContractID CustID 3.2 Customer Table Any customers who place a contract are added to this table. All columns must be completed. 8
8 Primary Key: CustID Foreign Keys: 3.3 Employee Table All employee data is to be entered on this table. Only job specific data may be stored on other tables. Some data can be omitted on this table. Primary Key: EmpID Foreign Keys: 3.4 Fabrication Table This table stores data regarding the Fabrications Identification number and the associated fabricator and order number for tracking purposes. 9
9 Primary Key: Foreign Keys: FabID EmpID, OrderID 3.5 Fabricator Table Stores information about an employee who is a fabricator. This is also used to help track production and also manage work load. Primary Key: EmpID Foreign Keys: 3.6 Flange Batch Table This table stores data on the production and composition of each flange supplied to the company. 10
10 Primary Key: Foreign Keys: F Batch Flange Type, Unit, Material Batch 3.7 Flange Type Table This table stores all the flanged used in any fabrication. Details about the flange must also be added. Primary Key: Flange Type Foreign Keys: 11
11 3.8 Flange Unit Table This tables stores information about any flange unit including technical information. Primary Key: Foreign Keys: Unit Material 3.9 Material Table Stores information on any material used within the manufacturing process. Primary Key: Material 12
12 Foreign Keys: 3.10 Material Batch Table This table store the batch information for any material that enters the factory. This is used for tracking purposes. Primary Key: Foreign Keys: Material Batch Material 3.11 Observation Table Table used to store testing information. 13
13 Primary Key: W Test Foreign Keys: 3.12 Pipe Batch Table This table stores data on the production and composition of each flange supplied to the company. Primary Key: Foreign Keys: P Batch P Type, Material Batch 3.13 Pipe Length Table Table stores technical information on the pipes supplied. 14
14 Primary Key: Length Serial Foreign Keys: P Batch 3.14 Pipe Type Table Stores information used in the different pipe types used in the fabrication. Primary Key: Foreign Keys: P Type Material 3.15 Rod Batch Table Stores information on the welding rod batched used. 15
15 Primary Key: Foreign Keys: R Batch Rod Type 3.16 Rod Type Table Stores information on the welding rods used to enable matching them to the correct welds. Primary Key: Foreign Keys: Rod Type Material 3.17 Test Operative Table Stores information on employees who are test operatives. 16
16 Primary Key: EmpID Foreign Keys: 3.18 Ultrasound Table Records testing information. Primary Key: W Test Foreign Keys: 3.19 Unit Order Table Stores information generated from contracts. This also includes a drawing reference number for tracking purposes. 17
17 Primary Key: Foreign Keys: OrderID ContractID, P Type, Flange Type 3.20 Weld Table Stores information on the welds used in a fabrication. Primary Key: Foreign Keys: Weld FabID, EmpID, Weld Type, R Batch 18
18 3.21 Weld Cert Table Stores information about the welding certificates required by welders. Primary Key: CertID Foreign Keys: 3.22 Welder Table Stores information on employees who are welders. 19
19 Primary Key: Foreign Keys: EmpID CertID 3.23 Weld Test Table Stores information on the testing of welds. Primary Key: Foreign Keys: W Test Weld, EmpID, FabID 20
20 3.24 Weld Type Table Stores information on the types if weld and the certificates associated with them. Primary Key: Foreign Keys: Weld Type CertID 3.25 X Ray Table Stores information on X Ray testing. 21
21 Primary Key: W Test Foreign Keys: 22
22 4. SQL CODE The section demonstrates manipulation of the database and its contents using SQL Code. Each individual section will show examples of Data Definition Language (DDL) and Data Manipulation Language (DML). The sample code used can be manipulated to be used with any Table in the Database by changing the Parameters defined in the sample code. 4.1 The SELECT Command (DML) The SELECT Command enables you to view specific information within a table. In this example I have chosen to view the Number of fabrications of 20 or above within the Contract Table. Note the Code used at the top of the screenshot and the results below it. 23
23 4.2 Adding a Record to a Table (DML) This section shows how to add a record to an existing table using SQL Code. In this example a 4 th record has been added to the Customer Table. Before: Table view showing only 3 records Code: View showing Code After: View showing new record. 24
24 4.3 Deleting a Record in a Table (DML) Using the previous example, we will now remove the 4 th record of the Customer Table. Below is the before and after views for Deleting a record. Before: The table showing 4 records Code: Shows the SQL Code to Delete a record After: The 4 th record is now removed 25
25 4.4 Updating a Record (DML) This section shows you how to update/change the contents of a given field within a record. Before: The code we will use is at the top of the window and the value we will update is located in record 2 under Number of fabrications. We will change this value from 30 to 50. Error: This error was produced due to the usage of within the Column Name. Corrected Code: You can see the has been removed from the Column name and the code has executed correctly. 26
26 After: you can now see the value has been change from 30 to
27 4.5 Ordering the records within a table (DML) Using the previous example, we can now order the records to show the information in a different way. In this example we want to order by the Number of fabrication and we want to see it in Descending order so we know who wants the most work. Note: the command DESC refers to Descending. Use the ASC command to order in Ascending order. Before: Shows the table before ordering After: Shows the code used at the top and the table in Descending order. 28
28 4.6 Creating a Table (DDL) This section shows how to create an additional table and also how to define a Primary Key. Also defined is the Data Types and if the fields will allow NULL s. Code: The screenshot below shows the code used to create a table. In this case a Supplier table. After: after refreshing the database structure you can now see the Supplier Table and also its structure view ready to receive data. 29
29 4.7 Dropping a Table (DDL) To remove or Drop a table from the database we can use the DROP TABLE command. Using the previous example we can drop the supplier table from the database. Code: You can see the code used and that it has ran successfully. I will not disappear from the view until you have refreshed the database tree structure. After a refresh: You can see it has now been removed. 30
30 4.8 Creating Views (DDL) This section describes the code used to create Views or Virtual tables. This views are stored within the tree structure and can be called upon within the SELECT Command used earlier in this document Code: The screenshot below shows the code used to create the view. Note the name for the view within the first line of code (in Black). Also note the view in the database tree structure. View: as you can see the view created only shows a small amount of data. This is because we only defined a small amount of data to be viewed (only ContractID s that have Number of fabrications of above 20) On the next page you can see the whole table for the Contracts and as you can see the ContractID has a Value for the Number of Fabrications of 50 and is the only one with a value above 20. Therefore the Code has executed correctly. 31
31 32
32 5. DETACH AND ATTACHING A DATABASE To be able to transport a database from one physical location to another or to add from a test environment to a live environment you can do the following. Note: The database created for this project has been detached from my Work PC and added to my user space at Teesside University (f ). 5.1 Detaching a Database To detach a Database, right click on the Database and select Tasks > Detach Then click Ok to detach the database 33
33 5.2 Attaching a Database To Attach or Reattach the Database, right click on Databases and click Attach. Click on Add on the next window and select the Database form the tree view (Location) and click OK To Transport the database to another location you can copy it from its existing location. 34
34 6. CRITICAL REVIEW 6.1 Review of Report I believe that this report conforms to the SCM Guidelines. However I do believe is could have added more relevant content to report to explain areas more clearly. 6.2 Review of Introduction I believe the key points were coved in the introduction and all key areas highlighted. 6.3 Review of ERD The production of the paper based model did give me some ideal of how the database would hang together. I only really developed the model once I used SQL Studio to design the database. I feel this section is a complete as it should be although extra notes on the ERD may be required. One oversight with the ERD and which was not mentioned in the Case Study would be adding in Supplier table to the database. I use the lack of this table to demonstrate code later in the report. 6.4 Review of Database implementation This was trickier than I first thought. As I am new to SQL design and implementation I feel that I took longer that planned to create relationships and also to ensure it flowed as required. Also imputing the sample data in the correct order to ensure database integrity (Some sections would not work due to relationships between tables. I.e can t enter data because it is not on another table first). This reassured me that the database is working as it should. 6.5 Review of SQL Code This was daunting challenge at first. The code I used was what I believed the company may want to use. After working with the code for a few minutes I felt more confident with it. 6.6 Review of Personal Development Overall I feel that my knowledge of SQL databases has been enhanced dramatically though the module. I work with SQL but up until now only through installing it and recovering data from backups. This module has given me a platform to develop further within my current career. 35
35 7. REFERENCES Mansha Nawaz. Databases & SQL website Sample Report 2007.dd.mercer.gary Located on page: Sample Report 2007.dd.Collom.David Located on page: Sample Report 2007.dd.marley.david Located on page: Sample Report 2007.dd.oliver.j Located on page: Training Videos Video Series: SQL Server 2005 Express Edition for Beginners us/express/aa aspx 36
36 8. APPICES 8.1 Database Script File SET QUOTED_IDENTIFIER ON IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Weld Cert]') AND type in (N'U')) BEGIN CREATE TABLE [dbo].[weld Cert]( [CertID] [nchar](10) NOT NULL, [Cert type] [nchar](50) NULL, CONSTRAINT [PK_Weld Cert] PRIMARY KEY CLUSTERED ( [CertID] ASC )WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY] ) ON [PRIMARY] SET QUOTED_IDENTIFIER ON IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Customer]') AND type in (N'U')) BEGIN CREATE TABLE [dbo].[customer]( [CustID] [int] NOT NULL, [Cust Name] [nchar](15) NOT NULL, [Address] [nchar](50) NOT NULL, [Contact] [nchar](30) NOT NULL, [Contact Tel] [nchar](12) NOT NULL, [ContractID] [int] NOT NULL, CONSTRAINT [PK_Customer] PRIMARY KEY CLUSTERED ( [CustID] ASC )WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY] ) ON [PRIMARY] SET QUOTED_IDENTIFIER ON IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Flange Type]') AND type in (N'U')) BEGIN 37
37 CREATE TABLE [dbo].[flange Type]( [Flange Type] [nchar](3) NOT NULL, [Description] [nchar](100) NOT NULL, CONSTRAINT [PK_Flange Type] PRIMARY KEY CLUSTERED ( [Flange Type] ASC )WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY] ) ON [PRIMARY] SET QUOTED_IDENTIFIER ON IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Material]') AND type in (N'U')) BEGIN CREATE TABLE [dbo].[material]( [Material] [nchar](50) NOT NULL, [Material Description] [nchar](100) NOT NULL, [Composition] [nchar](100) NOT NULL, CONSTRAINT [PK_Material] PRIMARY KEY CLUSTERED ( [Material] ASC )WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY] ) ON [PRIMARY] SET QUOTED_IDENTIFIER ON IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Test Operative]') AND type in (N'U')) BEGIN CREATE TABLE [dbo].[test Operative]( [EmpID] [smallint] NOT NULL, [Date of Training] [smalldatetime] NOT NULL, [Date of Sight test] [smalldatetime] NOT NULL, [X ray tests performed] [smallint] NULL, CONSTRAINT [PK_Test Operative] PRIMARY KEY CLUSTERED ( [EmpID] ASC )WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY] ) ON [PRIMARY] 38
38 SET QUOTED_IDENTIFIER ON IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Fabricator]') AND type in (N'U')) BEGIN CREATE TABLE [dbo].[fabricator]( [EmpID] [smallint] NOT NULL, [Rig Position] [nchar](20) NOT NULL, [RigID] [smallint] NOT NULL, [Maintenance Start Date/Time] [smalldatetime] NOT NULL, [Maintenance Finish Date/Time] [smalldatetime] NOT NULL, [No of Fabrications Assigned] [int] NULL, CONSTRAINT [PK_Fabricator] PRIMARY KEY CLUSTERED ( [EmpID] ASC )WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY] ) ON [PRIMARY] SET QUOTED_IDENTIFIER ON IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Rod Batch]') AND type in (N'U')) BEGIN CREATE TABLE [dbo].[rod Batch]( [R Batch] [nchar](14) NOT NULL, [Rod Type] [nchar](10) NULL, CONSTRAINT [PK_Rod Batch] PRIMARY KEY CLUSTERED ( [R Batch] ASC )WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY] ) ON [PRIMARY] SET QUOTED_IDENTIFIER ON IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Observation]') AND type in (N'U')) BEGIN CREATE TABLE [dbo].[observation]( [W Test] [int] NOT NULL, [Test SheetID] [nchar](10) NOT NULL, [Date/Time of test] [smalldatetime] NOT NULL, [Comment] [nchar](200) NOT NULL, [Reslut Code] [nchar](1) NOT NULL, CONSTRAINT [PK_Observation] PRIMARY KEY CLUSTERED 39
39 ( [W Test] ASC )WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY] ) ON [PRIMARY] SET QUOTED_IDENTIFIER ON IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[X Ray]') AND type in (N'U')) BEGIN CREATE TABLE [dbo].[x Ray]( [W Test] [int] NOT NULL, [Plate Serial Number] [nchar](10) NOT NULL, [Exposure Duration] [datetime] NOT NULL, [Comment] [nchar](300) NOT NULL, [Result Code] [nchar](1) NOT NULL, [Date/Time of Test] [smalldatetime] NOT NULL, CONSTRAINT [PK_X Ray] PRIMARY KEY CLUSTERED ( [W Test] ASC )WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY] ) ON [PRIMARY] SET QUOTED_IDENTIFIER ON IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Ultrasound]') AND type in (N'U')) BEGIN CREATE TABLE [dbo].[ultrasound]( [W Test] [int] NOT NULL, [Machine] [nchar](10) NOT NULL, [Result Code] [nchar](1) NOT NULL, [Frequency] [nchar](3) NOT NULL, [Comments] [nchar](200) NOT NULL, [Output Serial Number] [nchar](10) NOT NULL, [Date/Time of Test] [smalldatetime] NOT NULL, CONSTRAINT [PK_Ultrasound] PRIMARY KEY CLUSTERED ( [W Test] ASC )WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY] ) ON [PRIMARY] 40
40 SET QUOTED_IDENTIFIER ON IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Welder]') AND type in (N'U')) BEGIN CREATE TABLE [dbo].[welder]( [EmpID] [smallint] NOT NULL, [CertID] [nchar](10) NOT NULL, [Date Obtained] [smalldatetime] NOT NULL, [Renewal Date] [smalldatetime] NOT NULL, [Weld Experience] [nchar](200) NULL ) ON [PRIMARY] SET QUOTED_IDENTIFIER ON IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Weld Type]') AND type in (N'U')) BEGIN CREATE TABLE [dbo].[weld Type]( [Weld Type] [nchar](10) NOT NULL, [CertID] [nchar](10) NOT NULL, CONSTRAINT [PK_Weld Type_1] PRIMARY KEY CLUSTERED ( [Weld Type] ASC )WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY] ) ON [PRIMARY] SET QUOTED_IDENTIFIER ON IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Contract]') AND type in (N'U')) BEGIN CREATE TABLE [dbo].[contract]( [ContractID] [int] NOT NULL, [CustID] [int] NOT NULL, [Contract Date] [smalldatetime] NOT NULL, [Planned Delivery Date] [smalldatetime] NOT NULL, [Number of fabrications] [int] NOT NULL, CONSTRAINT [PK_Contract] PRIMARY KEY CLUSTERED ( [ContractID] ASC )WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY] 41
41 ) ON [PRIMARY] SET QUOTED_IDENTIFIER ON IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Unit Order]') AND type in (N'U')) BEGIN CREATE TABLE [dbo].[unit Order]( [OrderID] [int] NOT NULL, [ContractID] [int] NOT NULL, [Date] [smalldatetime] NOT NULL, [P Type] [nchar](5) NOT NULL, [Reference] [nchar](10) NOT NULL, [Flange Type] [nchar](3) NOT NULL, CONSTRAINT [PK_Unit Order] PRIMARY KEY CLUSTERED ( [OrderID] ASC )WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY] ) ON [PRIMARY] SET QUOTED_IDENTIFIER ON IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Flange Batch]') AND type in (N'U')) BEGIN CREATE TABLE [dbo].[flange Batch]( [F Batch] [nchar](4) NOT NULL, [Flange Type] [nchar](3) NOT NULL, [Unit] [nchar](10) NOT NULL, [Material Batch] [nchar](10) NOT NULL, [Number in Batch] [int] NOT NULL, CONSTRAINT [PK_Flange Batch] PRIMARY KEY CLUSTERED ( [F Batch] ASC )WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY] ) ON [PRIMARY] SET QUOTED_IDENTIFIER ON IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Weld Test]') AND type in (N'U')) 42
42 BEGIN CREATE TABLE [dbo].[weld Test]( [W Test] [int] NOT NULL, [Test Type] [nchar](11) NOT NULL, [Weld] [nchar](6) NOT NULL, [FabID] [nchar](10) NOT NULL, [EmpID] [smallint] NOT NULL, CONSTRAINT [PK_Weld Test] PRIMARY KEY CLUSTERED ( [W Test] ASC )WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY] ) ON [PRIMARY] SET QUOTED_IDENTIFIER ON IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Fabrication]') AND type in (N'U')) BEGIN CREATE TABLE [dbo].[fabrication]( [FabID] [nchar](10) NOT NULL, [EmpID] [smallint] NOT NULL, [OrderID] [int] NOT NULL, CONSTRAINT [PK_Fabrication] PRIMARY KEY CLUSTERED ( [FabID] ASC )WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY] ) ON [PRIMARY] SET QUOTED_IDENTIFIER ON IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Weld]') AND type in (N'U')) BEGIN CREATE TABLE [dbo].[weld]( [Weld] [nchar](6) NOT NULL, [FabID] [nchar](10) NOT NULL, [EmpID] [smallint] NOT NULL, [Weld Type] [nchar](10) NOT NULL, [R Batch] [nchar](14) NOT NULL, CONSTRAINT [PK_Weld] PRIMARY KEY CLUSTERED ( [Weld] ASC )WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY] 43
43 ) ON [PRIMARY] SET QUOTED_IDENTIFIER ON IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Pipe Type]') AND type in (N'U')) BEGIN CREATE TABLE [dbo].[pipe Type]( [P Type] [nchar](5) NOT NULL, [Material] [nchar](50) NOT NULL, [Description] [nchar](100) NOT NULL, CONSTRAINT [PK_Pipe Type] PRIMARY KEY CLUSTERED ( [P Type] ASC )WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY] ) ON [PRIMARY] SET QUOTED_IDENTIFIER ON IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Rod Type]') AND type in (N'U')) BEGIN CREATE TABLE [dbo].[rod Type]( [Rod Type] [nchar](10) NOT NULL, [Material] [nchar](50) NOT NULL, [Length] [float] NOT NULL, [Description] [nchar](100) NULL, CONSTRAINT [PK_Rod Type] PRIMARY KEY CLUSTERED ( [Rod Type] ASC )WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY] ) ON [PRIMARY] SET QUOTED_IDENTIFIER ON IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Flange Unit]') AND type in (N'U')) BEGIN CREATE TABLE [dbo].[flange Unit]( [Flange Type] [nchar](3) NOT NULL, [Unit] [nchar](10) NOT NULL, 44
44 [Drawing] [nchar](10) NOT NULL, [Material] [nchar](50) NOT NULL, [Length] [float] NOT NULL, [Thickness] [float] NOT NULL, [Bolt Hole Size] [float] NOT NULL, CONSTRAINT [PK_Flange Unit] PRIMARY KEY CLUSTERED ( [Unit] ASC )WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY] ) ON [PRIMARY] SET QUOTED_IDENTIFIER ON IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Material Batch]') AND type in (N'U')) BEGIN CREATE TABLE [dbo].[material Batch]( [Material Batch] [nchar](10) NOT NULL, [Material] [nchar](50) NULL, CONSTRAINT [PK_Material Batch] PRIMARY KEY CLUSTERED ( [Material Batch] ASC )WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY] ) ON [PRIMARY] SET QUOTED_IDENTIFIER ON IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Pipe Batch]') AND type in (N'U')) BEGIN CREATE TABLE [dbo].[pipe Batch]( [P Batch] [nchar](6) NOT NULL, [P Type] [nchar](5) NULL, [Material Batch] [nchar](10) NULL, CONSTRAINT [PK_Pipe Batch] PRIMARY KEY CLUSTERED ( [P Batch] ASC )WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY] ) ON [PRIMARY] 45
45 SET QUOTED_IDENTIFIER ON IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Pipe Length]') AND type in (N'U')) BEGIN CREATE TABLE [dbo].[pipe Length]( [Length Serial] [nchar](10) NOT NULL, [P Batch] [nchar](6) NOT NULL, CONSTRAINT [PK_Pipe Length] PRIMARY KEY CLUSTERED ( [P Batch] ASC )WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY] ) ON [PRIMARY] SET QUOTED_IDENTIFIER ON IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Employee]') AND type in (N'U')) BEGIN CREATE TABLE [dbo].[employee]( [EmpID] [smallint] NOT NULL, [Forenames] [nchar](20) NOT NULL, [Surname] [nchar](15) NOT NULL, [Home Tel] [nchar](12) NULL, [Address] [nchar](100) NOT NULL, [Hourly Rate] [smallmoney] NOT NULL, [Date Employed] [smalldatetime] NOT NULL, [Welder] [nchar](1) NULL, [Fabricator] [nchar](1) NULL, [Test Operative] [nchar](1) NULL, CONSTRAINT [PK_Employee] PRIMARY KEY CLUSTERED ( [EmpID] ASC )WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY] ) ON [PRIMARY] SET QUOTED_IDENTIFIER ON IF NOT EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[contract_id]')) EXEC = N'CREATE VIEW [dbo].[contract_id] AS SELECT ContractID FROM Contract WHERE [Number of fabrications] > 20 46
46 ' IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_Rod Batch_Rod Type]') AND parent_object_id = OBJECT_ID(N'[dbo].[Rod Batch]')) ALTER TABLE [dbo].[rod Batch] WITH CHECK ADD CONSTRAINT [FK_Rod Batch_Rod Type] FOREIGN KEY([Rod Type]) REFERENCES [dbo].[rod Type] ([Rod Type]) IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_Observation_Weld Test]') AND parent_object_id = OBJECT_ID(N'[dbo].[Observation]')) ALTER TABLE [dbo].[observation] WITH CHECK ADD CONSTRAINT [FK_Observation_Weld Test] FOREIGN KEY([W Test]) REFERENCES [dbo].[weld Test] ([W Test]) IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_X Ray_Weld Test]') AND parent_object_id = OBJECT_ID(N'[dbo].[X Ray]')) ALTER TABLE [dbo].[x Ray] WITH CHECK ADD CONSTRAINT [FK_X Ray_Weld Test] FOREIGN KEY([W Test]) REFERENCES [dbo].[weld Test] ([W Test]) IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_Ultrasound_Weld Test]') AND parent_object_id = OBJECT_ID(N'[dbo].[Ultrasound]')) ALTER TABLE [dbo].[ultrasound] WITH CHECK ADD CONSTRAINT [FK_Ultrasound_Weld Test] FOREIGN KEY([W Test]) REFERENCES [dbo].[weld Test] ([W Test]) IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_Welder_Employee]') AND parent_object_id = OBJECT_ID(N'[dbo].[Welder]')) ALTER TABLE [dbo].[welder] WITH CHECK ADD CONSTRAINT [FK_Welder_Employee] FOREIGN KEY([EmpID]) REFERENCES [dbo].[employee] ([EmpID]) IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_Welder_Weld Cert]') AND parent_object_id = OBJECT_ID(N'[dbo].[Welder]')) ALTER TABLE [dbo].[welder] WITH CHECK ADD CONSTRAINT [FK_Welder_Weld Cert] FOREIGN KEY([CertID]) REFERENCES [dbo].[weld Cert] ([CertID]) IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_Weld Type_Weld Cert1]') AND parent_object_id = OBJECT_ID(N'[dbo].[Weld Type]')) ALTER TABLE [dbo].[weld Type] WITH CHECK ADD CONSTRAINT [FK_Weld Type_Weld Cert1] FOREIGN KEY([CertID]) REFERENCES [dbo].[weld Cert] ([CertID]) IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_Contract_Customer]') AND parent_object_id = OBJECT_ID(N'[dbo].[Contract]')) ALTER TABLE [dbo].[contract] WITH CHECK ADD CONSTRAINT [FK_Contract_Customer] FOREIGN KEY([CustID]) REFERENCES [dbo].[customer] ([CustID]) IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_Unit Order_Contract]') AND parent_object_id = OBJECT_ID(N'[dbo].[Unit Order]')) ALTER TABLE [dbo].[unit Order] WITH CHECK ADD CONSTRAINT [FK_Unit Order_Contract] FOREIGN KEY([ContractID]) REFERENCES [dbo].[contract] ([ContractID]) 47
47 IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_Unit Order_Flange Type]') AND parent_object_id = OBJECT_ID(N'[dbo].[Unit Order]')) ALTER TABLE [dbo].[unit Order] WITH NOCHECK ADD CONSTRAINT [FK_Unit Order_Flange Type] FOREIGN KEY([Flange Type]) REFERENCES [dbo].[flange Type] ([Flange Type]) ALTER TABLE [dbo].[unit Order] CHECK CONSTRAINT [FK_Unit Order_Flange Type] IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_Unit Order_Pipe Type]') AND parent_object_id = OBJECT_ID(N'[dbo].[Unit Order]')) ALTER TABLE [dbo].[unit Order] WITH NOCHECK ADD CONSTRAINT [FK_Unit Order_Pipe Type] FOREIGN KEY([P Type]) REFERENCES [dbo].[pipe Type] ([P Type]) ALTER TABLE [dbo].[unit Order] CHECK CONSTRAINT [FK_Unit Order_Pipe Type] IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_Flange Batch_Flange Type]') AND parent_object_id = OBJECT_ID(N'[dbo].[Flange Batch]')) ALTER TABLE [dbo].[flange Batch] WITH CHECK ADD CONSTRAINT [FK_Flange Batch_Flange Type] FOREIGN KEY([Flange Type]) REFERENCES [dbo].[flange Type] ([Flange Type]) IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_Flange Batch_Flange Unit]') AND parent_object_id = OBJECT_ID(N'[dbo].[Flange Batch]')) ALTER TABLE [dbo].[flange Batch] WITH CHECK ADD CONSTRAINT [FK_Flange Batch_Flange Unit] FOREIGN KEY([Unit]) REFERENCES [dbo].[flange Unit] ([Unit]) IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_Flange Batch_Material Batch]') AND parent_object_id = OBJECT_ID(N'[dbo].[Flange Batch]')) ALTER TABLE [dbo].[flange Batch] WITH CHECK ADD CONSTRAINT [FK_Flange Batch_Material Batch] FOREIGN KEY([Material Batch]) REFERENCES [dbo].[material Batch] ([Material Batch]) IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_Weld Test_Employee]') AND parent_object_id = OBJECT_ID(N'[dbo].[Weld Test]')) ALTER TABLE [dbo].[weld Test] WITH CHECK ADD CONSTRAINT [FK_Weld Test_Employee] FOREIGN KEY([EmpID]) REFERENCES [dbo].[employee] ([EmpID]) IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_Weld Test_Fabrication]') AND parent_object_id = OBJECT_ID(N'[dbo].[Weld Test]')) ALTER TABLE [dbo].[weld Test] WITH CHECK ADD CONSTRAINT [FK_Weld Test_Fabrication] FOREIGN KEY([FabID]) REFERENCES [dbo].[fabrication] ([FabID]) IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_Weld Test_Test Operative]') AND parent_object_id = OBJECT_ID(N'[dbo].[Weld Test]')) ALTER TABLE [dbo].[weld Test] WITH CHECK ADD CONSTRAINT [FK_Weld Test_Test Operative] FOREIGN KEY([EmpID]) REFERENCES [dbo].[test Operative] ([EmpID]) IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_Weld Test_Weld]') AND parent_object_id = OBJECT_ID(N'[dbo].[Weld Test]')) 48
48 ALTER TABLE [dbo].[weld Test] WITH CHECK ADD CONSTRAINT [FK_Weld Test_Weld] FOREIGN KEY([Weld]) REFERENCES [dbo].[weld] ([Weld]) IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_Fabrication_Employee]') AND parent_object_id = OBJECT_ID(N'[dbo].[Fabrication]')) ALTER TABLE [dbo].[fabrication] WITH CHECK ADD CONSTRAINT [FK_Fabrication_Employee] FOREIGN KEY([EmpID]) REFERENCES [dbo].[employee] ([EmpID]) IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_Fabrication_Fabricator]') AND parent_object_id = OBJECT_ID(N'[dbo].[Fabrication]')) ALTER TABLE [dbo].[fabrication] WITH CHECK ADD CONSTRAINT [FK_Fabrication_Fabricator] FOREIGN KEY([EmpID]) REFERENCES [dbo].[fabricator] ([EmpID]) IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_Fabrication_Unit Order]') AND parent_object_id = OBJECT_ID(N'[dbo].[Fabrication]')) ALTER TABLE [dbo].[fabrication] WITH CHECK ADD CONSTRAINT [FK_Fabrication_Unit Order] FOREIGN KEY([OrderID]) REFERENCES [dbo].[unit Order] ([OrderID]) IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_Weld_Employee]') AND parent_object_id = OBJECT_ID(N'[dbo].[Weld]')) ALTER TABLE [dbo].[weld] WITH CHECK ADD CONSTRAINT [FK_Weld_Employee] FOREIGN KEY([EmpID]) REFERENCES [dbo].[employee] ([EmpID]) IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_Weld_Fabrication]') AND parent_object_id = OBJECT_ID(N'[dbo].[Weld]')) ALTER TABLE [dbo].[weld] WITH CHECK ADD CONSTRAINT [FK_Weld_Fabrication] FOREIGN KEY([FabID]) REFERENCES [dbo].[fabrication] ([FabID]) IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_Weld_Rod Batch]') AND parent_object_id = OBJECT_ID(N'[dbo].[Weld]')) ALTER TABLE [dbo].[weld] WITH CHECK ADD CONSTRAINT [FK_Weld_Rod Batch] FOREIGN KEY([R Batch]) REFERENCES [dbo].[rod Batch] ([R Batch]) IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_Weld_Weld Type]') AND parent_object_id = OBJECT_ID(N'[dbo].[Weld]')) ALTER TABLE [dbo].[weld] WITH CHECK ADD CONSTRAINT [FK_Weld_Weld Type] FOREIGN KEY([Weld Type]) REFERENCES [dbo].[weld Type] ([Weld Type]) IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_Pipe Type_Material]') AND parent_object_id = OBJECT_ID(N'[dbo].[Pipe Type]')) ALTER TABLE [dbo].[pipe Type] WITH CHECK ADD CONSTRAINT [FK_Pipe Type_Material] FOREIGN KEY([Material]) REFERENCES [dbo].[material] ([Material]) IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_Rod Type_Material]') AND parent_object_id = OBJECT_ID(N'[dbo].[Rod Type]')) ALTER TABLE [dbo].[rod Type] WITH CHECK ADD CONSTRAINT [FK_Rod Type_Material] FOREIGN KEY([Material]) REFERENCES [dbo].[material] ([Material]) 49
49 IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_Flange Unit_Material]') AND parent_object_id = OBJECT_ID(N'[dbo].[Flange Unit]')) ALTER TABLE [dbo].[flange Unit] WITH CHECK ADD CONSTRAINT [FK_Flange Unit_Material] FOREIGN KEY([Material]) REFERENCES [dbo].[material] ([Material]) IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_Material Batch_Material]') AND parent_object_id = OBJECT_ID(N'[dbo].[Material Batch]')) ALTER TABLE [dbo].[material Batch] WITH CHECK ADD CONSTRAINT [FK_Material Batch_Material] FOREIGN KEY([Material]) REFERENCES [dbo].[material] ([Material]) IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_Pipe Batch_Material Batch]') AND parent_object_id = OBJECT_ID(N'[dbo].[Pipe Batch]')) ALTER TABLE [dbo].[pipe Batch] WITH CHECK ADD CONSTRAINT [FK_Pipe Batch_Material Batch] FOREIGN KEY([Material Batch]) REFERENCES [dbo].[material Batch] ([Material Batch]) IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_Pipe Batch_Pipe Type]') AND parent_object_id = OBJECT_ID(N'[dbo].[Pipe Batch]')) ALTER TABLE [dbo].[pipe Batch] WITH CHECK ADD CONSTRAINT [FK_Pipe Batch_Pipe Type] FOREIGN KEY([P Type]) REFERENCES [dbo].[pipe Type] ([P Type]) IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_Pipe Length_Pipe Batch]') AND parent_object_id = OBJECT_ID(N'[dbo].[Pipe Length]')) ALTER TABLE [dbo].[pipe Length] WITH CHECK ADD CONSTRAINT [FK_Pipe Length_Pipe Batch] FOREIGN KEY([P Batch]) REFERENCES [dbo].[pipe Batch] ([P Batch]) IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_Employee_Fabricator]') AND parent_object_id = OBJECT_ID(N'[dbo].[Employee]')) ALTER TABLE [dbo].[employee] WITH NOCHECK ADD CONSTRAINT [FK_Employee_Fabricator] FOREIGN KEY([EmpID]) REFERENCES [dbo].[fabricator] ([EmpID]) IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_Employee_Test Operative]') AND parent_object_id = OBJECT_ID(N'[dbo].[Employee]')) ALTER TABLE [dbo].[employee] WITH NOCHECK ADD CONSTRAINT [FK_Employee_Test Operative] FOREIGN KEY([EmpID]) REFERENCES [dbo].[test Operative] ([EmpID]) 50
HSQ Databases and SQL
HSQ Databases and SQL Server Database Golf Forum and Handicap Calculator Reader: Mansha Nawaz Author: Michael Ord H8128179 Contents 1. CASE STUDY... 4 1.1. CASE STUDY SCENARIO... 4 1.2. CASE STUDY ADDITIONAL
More informationMATTHEW COLLINS H
TEESSIDE UNIVERSITY MODULE TITLE DATABASES AND SQL ASSIGNMENT TITLE CASE STUDY: SERVER DATABASE EXAMPLE MATTHEW COLLINS H8851143 Contents 1 CASE STUDY... 4 1.1 SCENARIO... 4 1.2 ADDITIONAL CONSIDERATIONS...
More informationMARIA AMPARO FUENTES-OREA (F ) HSQ-DATABASES & SQL MANSHA NAWAZ. SERVER DATABASE EXAMPLE Generic Sales Order Processing System
MARIA AMPARO FUENTES-OREA (F-6102492) HSQ-DATABASES & SQL MANSHA NAWAZ SERVER DATABASE EXAMPLE Generic Sales Order Processing System Table of Contents 1. Case Study...3 1.1. Case study Scenario...3 1.2.
More informationInformation Systems Engineering. SQL Structured Query Language DDL Data Definition (sub)language
Information Systems Engineering SQL Structured Query Language DDL Data Definition (sub)language 1 SQL Standard Language for the Definition, Querying and Manipulation of Relational Databases on DBMSs Its
More informationHOW TO CREATE AND MAINTAIN DATABASES AND TABLES. By S. Sabraz Nawaz Senior Lecturer in MIT FMC, SEUSL
HOW TO CREATE AND MAINTAIN DATABASES AND TABLES By S. Sabraz Nawaz Senior Lecturer in MIT FMC, SEUSL What is SQL? SQL (pronounced "ess-que-el") stands for Structured Query Language. SQL is used to communicate
More informationNormalization. Normal Forms. Normal Forms
Normalization A technique that organizes data attributes (or fields) such that they are grouped to form stable, flexible and adaptive entities. 5- Normal Forms First Normal Form (NF) There are no attributes
More informationInspection Management System (IMS) A Welding NDE Management Program for Fabricated Piping Systems
Inspection Management System (IMS) A Welding NDE Management Program for Fabricated Piping Systems General Information Overview IMS is a comprehensive software program for managing welding and non-destructive
More informationLab 6 SQL-DDL Advanced in SQL Server 2008
Department of Computer Science University of Cyprus EPL342 Databases Lab 6 SQL-DDL Advanced in SQL Server 2008 Panayiotis Andreou http://www.cs.ucy.ac.cy/courses/epl342 6-1 Before We Begin Start the SQL
More informationSQL Server 2008 Tutorial 3: Database Creation
SQL Server 2008 Tutorial 3: Database Creation IT 5101 Introduction to Database Systems J.G. Zheng Fall 2011 DDL Action in SQL Server Creating and modifying structures using the graphical interface Table
More informationCreating databases using SQL Server Management Studio Express
Creating databases using SQL Server Management Studio Express With the release of SQL Server 2005 Express Edition, TI students and professionals began to have an efficient, professional and cheap solution
More informationAccredited Testing Facility (ATF) 3 rd Year On-Site Audit Checklist
Facility Information: ATF Certificate #: Test Facility Name: Test Facility Representative: Address: City: State Zip: Phone Phone: Fax: Email: Facility Assessor: AWS Auditor: Date: Date: 3 rd Year On-Site
More informationChapter 9: Working with MySQL
Chapter 9: Working with MySQL Informatics Practices Class XI (CBSE Board) Revised as per CBSE Curriculum 2015 Visit www.ip4you.blogspot.com for more. Authored By:- Rajesh Kumar Mishra, PGT (Comp.Sc.) Kendriya
More informationAppendix A. Using DML to Modify Data. Contents: Lesson 1: Adding Data to Tables A-3. Lesson 2: Modifying and Removing Data A-8
A-1 Appendix A Using DML to Modify Data Contents: Lesson 1: Adding Data to Tables A-3 Lesson 2: Modifying and Removing Data A-8 Lesson 3: Generating Numbers A-15 A-2 Using DML to Modify Data Module Overview
More informationDeccansoft softwareservices-microsoft Silver Learing Partner. SQL Server Syllabus
SQL Server Syllabus Overview: Microsoft SQL Server is one the most popular Relational Database Management System (RDBMS) used in Microsoft universe. It can be used for data storage as well as for data
More informationSQL - Tables. SQL - Create a SQL Table. SQL Create Table Query:
SQL - Tables Data is stored inside SQL tables which are contained within SQL databases. A single database can house hundreds of tables, each playing its own unique role in th+e database schema. While database
More informationUNIVERSITY OF TEESSIDE SCHOOL OF COMPUTING
UNIVERSITY OF TEESSIDE SCHOOL OF COMPUTING HND Databases and SQL Case Study Server Database Example Author: Reader: Mansha Nawas Submission Date: 15/01/2010 Contents Title Page...i Contents...ii Planning...
More informationDrop Table Query Sql Server If Exists 2008 R2
Drop Table Query Sql Server If Exists 2008 R2 Check If left blank, it will check for all the tables in the database IF OBJECT_ID('SearchTMP','U') IS NOT NULL DROP TABLE SearchTMP EXEC (@SQL) IF EXISTS(SELECT
More informationCourse Prerequisites: This course requires that you meet the following prerequisites:
Developing MS SQL Server Databases This five-day instructor-led course introduces SQL Server 2014 and describes logical table design, indexing and query plans. It also focusses on the creation of database
More informationExam code: Exam name: Database Fundamentals. Version 16.0
98-364 Number: 98-364 Passing Score: 800 Time Limit: 120 min File Version: 16.0 Exam code: 98-364 Exam name: Database Fundamentals Version 16.0 98-364 QUESTION 1 You have a table that contains the following
More informationConfiguring comparison & script generation options
Configuring comparison & script generation options The ReadyRoll tool-window provides an effective way to generate new migration scripts within your database project. The tool uses the industry-standard
More informationDatabase and table creation
Database and table creation Introduction SQL - Structured Query Language used to create, modify databases, and to place and retrieve data from databases. SQL was developed in the 70s at IBM. It has become
More informationRecommended Maintenance Plan for Siriusware Clients for SQL server 2005
Recommended Maintenance Plan for Siriusware Clients for SQL server 2005 PURPOSE The purpose of this document is to describe how to automate the periodic rebuilding of indexes for the SiriusSQL database.
More informationModule 5: Implementing Data Integrity
Module 5: Implementing Data Integrity Overview Types of Data Integrity Enforcing Data Integrity Defining Constraints Types of Constraints Disabling Constraints Using Defaults and Rules Deciding Which Enforcement
More informationMANAGING SIMS.NET USERS, AND ALLOCATING TO PERMISSION GROUPS
MANAGING SIMS.NET USERS, AND ALLOCATING TO PERMISSION GROUPS Introduction From time to time you will want to add users to SIMS, or modify the activities that users have permission to carry out. You will
More informationORACLE PL/SQL DATABASE COURSE
ORACLE PL/SQL DATABASE COURSE Oracle PL/SQL Database Programming Course (OPDP-001) JMT Oracle PL/SQL Hands-On Training (OPDP-001) is an intense hands-on course that is designed to give the student maximum
More informationDepartment of Computer Science University of Cyprus. EPL342 Databases. Lab 2
Department of Computer Science University of Cyprus EPL342 Databases Lab 2 ER Modeling (Entities) in DDS Lite & Conceptual Modeling in SQL Server 2008 Panayiotis Andreou http://www.cs.ucy.ac.cy/courses/epl342
More informationInvitation to Tender - Reply Form
Invitation to Tender - Reply Form Licence to Sell Uniform and Sportswear You might like to use this as a basis for your form but please note that it should be tailored to your specific requirements. It
More informationSystem Pages (Setup Admins Only)
System Pages (Setup Admins Only) 1 Primary System Pages 2 More on Page Views & Sub Page Views 3 4 System Lookup Pages 5 6 7 Distinguishing Tables, Pages, Filtered Pages, & Page Views 8 9 Reasons to Create
More informationData about data is database Select correct option: True False Partially True None of the Above
Within a table, each primary key value. is a minimal super key is always the first field in each table must be numeric must be unique Foreign Key is A field in a table that matches a key field in another
More information8) A top-to-bottom relationship among the items in a database is established by a
MULTIPLE CHOICE QUESTIONS IN DBMS (unit-1 to unit-4) 1) ER model is used in phase a) conceptual database b) schema refinement c) physical refinement d) applications and security 2) The ER model is relevant
More informationSQL. Char (30) can store ram, ramji007 or 80- b
SQL In Relational database Model all the information is stored on Tables, these tables are divided into rows and columns. A collection on related tables are called DATABASE. A named table in a database
More informationSQL: Concepts. Todd Bacastow IST 210: Organization of Data 2/17/ IST 210
SQL: Concepts Todd Bacastow IST 210: Organization of Data 2/17/2004 1 Design questions How many entities are there? What are the major entities? What are the attributes of each entity? Is there a unique
More informationPrivate Institute of Aga NETWORK DATABASE LECTURER NIYAZ M. SALIH
Private Institute of Aga 2018 NETWORK DATABASE LECTURER NIYAZ M. SALIH Data Definition Language (DDL): String data Types: Data Types CHAR(size) NCHAR(size) VARCHAR2(size) Description A fixed-length character
More informationUnit Assessment Guide
Unit Assessment Guide Unit Details Unit code Unit name Unit purpose/application ICTWEB425 Apply structured query language to extract and manipulate data This unit describes the skills and knowledge required
More informationIBM DB2 UDB V7.1 Family Fundamentals.
IBM 000-512 DB2 UDB V7.1 Family Fundamentals http://killexams.com/exam-detail/000-512 Answer: E QUESTION: 98 Given the following: A table containing a list of all seats on an airplane. A seat consists
More informationChapter 4. Basic SQL. Copyright 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
Chapter 4 Basic SQL Copyright 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 4 Outline SQL Data Definition and Data Types Specifying Constraints in SQL Basic Retrieval Queries
More informationMySQL for Beginners Ed 3
MySQL for Beginners Ed 3 Duration: 4 Days What you will learn The MySQL for Beginners course helps you learn about the world's most popular open source database. Expert Oracle University instructors will
More informationGet Table Schema In Sql Server 2008 To Add Column If Not Exists >>>CLICK HERE<<<
Get Table Schema In Sql Server 2008 To Add Column If Not Exists IF NOT EXISTS ( SELECT * FROM sys.columns WHERE object_id = OBJECT_ID(N'(dbo). Also try catch is easily possible to use in sql serverand
More informationCOGS 121 HCI Programming Studio. Week 03 - Tech Lecture
COGS 121 HCI Programming Studio Week 03 - Tech Lecture Housekeeping Assignment #1 extended to Monday night 11:59pm Assignment #2 to be released on Tuesday during lecture Database Management Systems and
More informationBI4Dynamics AX/NAV Integrate external data sources
BI4Dynamics AX/NAV Last update: November 2018 Version: 2.1 Abbreviation used in this document: EDS: External Data Source(s) are data that are not a part of Microsoft Dynamics AX/NAV. It can come from any
More informationSQL Coding Guidelines
SQL Coding Guidelines 1. Always specify SET NOCOUNT ON at the top of the stored procedure, this command suppresses the result set count information thereby saving some amount of time spent by SQL Server.
More informationData Infrastructure IRAP Training 6/27/2016
Data Infrastructure IRAP Training 6/27/2016 UCDW Database Models Integrity Constraints Training Database SQL Defined Types of SQL Languages SQL Basics Simple SELECT SELECT with Aliases SELECT with Conditions/Rules
More informationChapter 4. Basic SQL. SQL Data Definition and Data Types. Basic SQL. SQL language SQL. Terminology: CREATE statement
Chapter 4 Basic SQL Basic SQL SQL language Considered one of the major reasons for the commercial success of relational databases SQL Structured Query Language Statements for data definitions, queries,
More informationSQL (Structured Query Language)
Lecture Note #4 COSC4820/5820 Database Systems Department of Computer Science University of Wyoming Byunggu Yu, 02/13/2001 SQL (Structured Query Language) 1. Schema Creation/Modification: DDL (Data Definition
More informationBabu Madhav Institute of Information Technology 2015
Paper No.:060010102 Subject: Database Management Systems (Practical) Program: 5 Years Integrated M.Sc.(IT) Semester: 01 Practical No: 1 Enrolment No: Practical Problem Create following tables: CLIENT_MASTER
More informationDATABASE DEVELOPMENT (H4)
IMIS HIGHER DIPLOMA QUALIFICATIONS DATABASE DEVELOPMENT (H4) December 2017 10:00hrs 13:00hrs DURATION: 3 HOURS Candidates should answer ALL the questions in Part A and THREE of the five questions in Part
More informationConfirming Trainees Satisfy WellSharp Course Prerequisites
Confirming Trainees Satisfy WellSharp Course Prerequisites WellSharp Course Prerequisite Policy Statement WellSharp is an industry-defined well control training and assessment standard, and as such, conformance
More informationLab # 4 Hands-On. DDL and DML Advance SQL Statements Institute of Computer Science, University of Tartu, Estonia
Lab # 4 Hands-On DDL and DML Advance SQL Statements Institute of Computer Science, University of Tartu, Estonia Advance Part A: Demo by Instructor in Lab a. AND/OR - Operators are used to filter records
More information1Z Oracle Database 11g - SQL Fundamentals I Exam Summary Syllabus Questions
1Z0-051 Oracle Database 11g - SQL Fundamentals I Exam Summary Syllabus Questions Table of Contents Introduction to 1Z0-051 Exam on Oracle Database 11g - SQL Fundamentals I 2 Oracle 1Z0-051 Certification
More informationMET CS 669 Database Design and Implementation for Business Term Project: Online DVD Rental Business
MET CS 669 Database Design and Implementation for Business Term Project: Online DVD Rental Business Objective Create an initial design for the database schema for an online DVD rental business that is
More informationChapter 1 SQL and Data
Chapter 1 SQL and Data What is SQL? Structured Query Language An industry-standard language used to access & manipulate data stored in a relational database E. F. Codd, 1970 s IBM 2 What is Oracle? A relational
More informationVETtrak Data Insights User Guide. for VETtrak version
VETtrak Data Insights User Guide for VETtrak version 4.4.8.2 Contents Data Insights User Guide... 2 What are Data Insights?... 2 Why is it called Data Insights?... 2 Why did we create this new feature?...
More informationChange Tracking Framework
Change Tracking Framework for Microsoft SQL Server Sergey Vaselenko Change Tracking Framework for Microsoft SQL Server Written by Sergey Vaselenko This e-book describes the change tracking framework for
More informationSql Server Syllabus. Overview
Sql Server Syllabus Overview This SQL Server training teaches developers all the Transact-SQL skills they need to create database objects like Tables, Views, Stored procedures & Functions and triggers
More informationGuides for Installing MS SQL Server and Creating Your First Database. Please see more guidelines on installing procedure on the class webpage
Guides for Installing MS SQL Server and Creating Your First Database Installing process Please see more guidelines on installing procedure on the class webpage 1. Make sure that you install a server with
More informationSQL Structured Query Language Introduction
SQL Structured Query Language Introduction Rifat Shahriyar Dept of CSE, BUET Tables In relational database systems data are represented using tables (relations). A query issued against the database also
More informationColumnStore Indexes UNIQUE and NOT DULL
Agenda ColumnStore Indexes About me The Basics Key Characteristics DEMO SQL Server 2014 ColumnStore indexes DEMO Best Practices Data Types Restrictions SQL Server 2016+ ColumnStore indexes Gareth Swanepoel
More informationDatabase Management System 9
Database Management System 9 School of Computer Engineering, KIIT University 9.1 Relational data model is the primary data model for commercial data- processing applications A relational database consists
More informationCGS 3066: Spring 2017 SQL Reference
CGS 3066: Spring 2017 SQL Reference Can also be used as a study guide. Only covers topics discussed in class. This is by no means a complete guide to SQL. Database accounts are being set up for all students
More informationERD Tutorial: How to Design and Generate SQL Server DB? Written Date : June 19, 2015
ERD : How to Design and Generate SQL Server DB? ERD : How to Design and Generate SQL Server DB? Written Date : June 9, 05 You can design database with ERD, and construct database by generating from the
More informationDatabase Systems Overview. Truong Tuan Anh CSE-HCMUT
Database Systems Overview Truong Tuan Anh CSE-HCMUT Outline File-based Approach and Database Approach Three-Schema Architecture and Data Independence Database Languages Data Models, Database Schema, Database
More informationAggregating and Pivoting Data
Chapter 6 Aggregating and Pivoting Data In this chapter: OVER Clause..........................................................315 Tiebreakers...........................................................319
More informationLecture 07. Spring 2018 Borough of Manhattan Community College
Lecture 07 Spring 2018 Borough of Manhattan Community College 1 SQL Identifiers SQL identifiers are used to identify objects in the database, such as table names, view names, and columns. The ISO standard
More informationSQL: Data De ni on. B0B36DBS, BD6B36DBS: Database Systems. h p://www.ksi.m.cuni.cz/~svoboda/courses/172-b0b36dbs/ Lecture 3
B0B36DBS, BD6B36DBS: Database Systems h p://www.ksi.m.cuni.cz/~svoboda/courses/172-b0b36dbs/ Lecture 3 SQL: Data De ni on Mar n Svoboda mar n.svoboda@fel.cvut.cz 13. 3. 2018 Czech Technical University
More informationUpdate Table Schema Sql Server 2008 Add Column Default Value
Update Table Schema Sql Server 2008 Add Column Default Value In SQL Server 2008, I am adding a non-nullable column to an existing table, and INTO MyTable DEFAULT VALUES GO 1000 ALTER TABLE MyTable ADD.
More informationCASTI. CASTI Career Path. rev
CASTI Code and Standards Training Institute CASTI Career Path rev. 130531 Contents CAST CAREER PATH DIAGRAM CASTI CAREER PATH DESCRIPTION GETTING STARTED: ALBERTA WELDING EXAMINER 1 GETTING STARTED: CSA
More informationDepartment of Computer Science University of Cyprus. EPL342 Databases. Lab 1. Introduction to SQL Server Panayiotis Andreou
Department of Computer Science University of Cyprus EPL342 Databases Lab 1 Introduction to SQL Server 2008 Panayiotis Andreou http://www.cs.ucy.ac.cy/courses/epl342 1-1 Before We Begin Start the SQL Server
More informationSQL Fundamentals. Chapter 3. Class 03: SQL Fundamentals 1
SQL Fundamentals Chapter 3 Class 03: SQL Fundamentals 1 Class 03: SQL Fundamentals 2 SQL SQL (Structured Query Language): A language that is used in relational databases to build and query tables. Earlier
More informationSQL Server and SQL Structured Query Language
SQL Server and SQL Structured Query Language Step by step Exercises Hans-Petter Halvorsen Database Systems Hans-Petter Halvorsen, M.Sc. Database Systems A Database is a structured way to store lots of
More information6232B: Implementing a Microsoft SQL Server 2008 R2 Database
6232B: Implementing a Microsoft SQL Server 2008 R2 Database Course Overview This instructor-led course is intended for Microsoft SQL Server database developers who are responsible for implementing a database
More informationSQL Data Definition Language: Create and Change the Database Ray Lockwood
Introductory SQL SQL Data Definition Language: Create and Change the Database Pg 1 SQL Data Definition Language: Create and Change the Database Ray Lockwood Points: DDL statements create and alter the
More information12 Rules Defined by Dr.Codd for a Relational Database Management System
Suggested Books 1. Delphi/Kylix Database Development Eric Harmon Sams Publishing 2. Delphi in a Nutshell Ray Lischner O Reilly Publishing 3. Delphi 6 Developer s Guide Xavier Pacheco et al Sams Publishing
More informationSQL DDL II. CS121: Relational Databases Fall 2017 Lecture 8
SQL DDL II CS121: Relational Databases Fall 2017 Lecture 8 Last Lecture 2 Covered SQL constraints NOT NULL constraints CHECK constraints PRIMARY KEY constraints FOREIGN KEY constraints UNIQUE constraints
More information5 Years Integrated M.Sc.(IT) Semester 1 Practical LIST CC2 Database Management Systems
5 Years Integrated M.Sc.(IT) Semester 1 Practical LIST 060010110 CC2 Database Management Systems Practical No: 1 Duration for completion PEO(s) to be PO(s) to be CO(s) to be Date Group Analyze : Athe scenario
More information20464 Developing Microsoft SQL Server Databases
Course Overview This 5-day instructor-led course introduces SQL Server 2014 and describes logical table design, indexing and query plans. It also focuses on the creation of database objects including views,
More informationLecture 5 STRUCTURED ANALYSIS. PB007 So(ware Engineering I Faculty of Informa:cs, Masaryk University Fall Bühnová, Sochor, Ráček
Lecture 5 STRUCTURED ANALYSIS PB007 So(ware Engineering I Faculty of Informa:cs, Masaryk University Fall 2015 1 Outline ² Yourdon Modern Structured Analysis (YMSA) Context diagram (CD) Data flow diagram
More informationTen Great Reasons to Learn SAS Software's SQL Procedure
Ten Great Reasons to Learn SAS Software's SQL Procedure Kirk Paul Lafler, Software Intelligence Corporation ABSTRACT The SQL Procedure has so many great features for both end-users and programmers. It's
More informationCourse Modules for MCSA: SQL Server 2016 Database Development Training & Certification Course:
Course Modules for MCSA: SQL Server 2016 Database Development Training & Certification Course: 20762C Developing SQL 2016 Databases Module 1: An Introduction to Database Development Introduction to the
More informationPhysical Design of Relational Databases
Physical Design of Relational Databases Chapter 8 Class 06: Physical Design of Relational Databases 1 Physical Database Design After completion of logical database design, the next phase is the design
More informationDatabase Systems: Design, Implementation, and Management Tenth Edition. Chapter 7 Introduction to Structured Query Language (SQL)
Database Systems: Design, Implementation, and Management Tenth Edition Chapter 7 Introduction to Structured Query Language (SQL) Objectives In this chapter, students will learn: The basic commands and
More informationIBM. Database Database overview. IBM i 7.1
IBM IBM i Database Database overview 7.1 IBM IBM i Database Database overview 7.1 Note Before using this information and the product it supports, read the information in Notices, on page 39. This edition
More informationMobile MOUSe MTA DATABASE ADMINISTRATOR FUNDAMENTALS ONLINE COURSE OUTLINE
Mobile MOUSe MTA DATABASE ADMINISTRATOR FUNDAMENTALS ONLINE COURSE OUTLINE COURSE TITLE MTA DATABASE ADMINISTRATOR FUNDAMENTALS COURSE DURATION 10 Hour(s) of Self-Paced Interactive Training COURSE OVERVIEW
More informationLab # 4. Data Definition Language (DDL)
Islamic University of Gaza Faculty of Engineering Department of Computer Engineering ECOM 4113: Lab # 4 Data Definition Language (DDL) Eng. Haneen El-Masry November, 2014 2 Objective To be familiar with
More informationSql Server Compare Two Tables To Find Differences
Sql Server Compare Two Tables To Find Differences compare and find differences for SQL Server tables and data When the User set two Employees ID (for example : 1 & 2) the program is supposed to show. Ways
More informationExact Numeric Data Types
SQL Server Notes for FYP SQL data type is an attribute that specifies type of data of any object. Each column, variable and expression has related data type in SQL. You would use these data types while
More informationThe appendix contains information about the Classic Models database. Place your answers on the examination paper and any additional paper used.
Name: Student Number: Instructions: Do all 9 questions. There is a total of 87 marks. The appendix contains information about the Classic Models database. Place your answers on the examination paper and
More informationIBM i Version 7.2. Database Database overview IBM
IBM i Version 7.2 Database Database overview IBM IBM i Version 7.2 Database Database overview IBM Note Before using this information and the product it supports, read the information in Notices on page
More informationToday Learning outcomes LO2
2015 2016 Phil Smith Today Learning outcomes LO2 On successful completion of this unit you will: 1. Be able to design and implement relational database systems. 2. Requirements. 3. User Interface. I am
More informationSQL Data Definition and Data Manipulation Languages (DDL and DML)
.. Cal Poly CPE/CSC 365: Introduction to Database Systems Alexander Dekhtyar.. SQL Data Definition and Data Manipulation Languages (DDL and DML) Note: This handout instroduces both the ANSI SQL synatax
More information20464: Developing Microsoft SQL Server 2014 Databases
20464: Developing Microsoft SQL Server 2014 Databases Course Outline Module 1: Introduction to Database Development This module introduces database development and the key tasks that a database developer
More informationMCSE Data Management and Analytics. A Success Guide to Prepare- Developing Microsoft SQL Server Databases. edusum.com
70-464 MCSE Data Management and Analytics A Success Guide to Prepare- Developing Microsoft SQL Server Databases edusum.com Table of Contents Introduction to 70-464 Exam on Developing Microsoft SQL Server
More informationAssignment Grading Rubric
Final Project Outcomes addressed in this activity: Overview and Directions: 1. Create a new Empty Database called Final 2. CREATE TABLES The create table statements should work without errors, have the
More informationSimple Quesries in SQL & Table Creation and Data Manipulation
Simple Quesries in SQL & Table Creation and Data Manipulation Based on CBSE Curriculum Class -11 By- Neha Tyagi PGT CS KV 5 Jaipur II Shift Jaipur Region Neha Tyagi, PGT CS II Shift Jaipur Introduction
More informationNotification Module Script
Notification Module Script The notification module enables the user to specify a set of notification events that could occur during data transactions and as a result trigger the automatic generation of
More information[MS20464]: Developing Microsoft SQL Server 2014 Databases
[MS20464]: Developing Microsoft SQL Server 2014 Databases Length : 5 Days Audience(s) : IT Professionals Level : 300 Technology : SQL Server Delivery Method : Instructor-led (Classroom) Course Overview
More informationLab # 2. Data Definition Language (DDL) Eng. Alaa O Shama
The Islamic University of Gaza Faculty of Engineering Department of Computer Engineering ECOM 4113: Database Lab Lab # 2 Data Definition Language (DDL) Eng. Alaa O Shama October, 2015 Objective To be familiar
More informationOracle Alter Table Add Unique Constraint Using Index Tablespace
Oracle Alter Table Add Unique Constraint Using Index Tablespace You must also have space quota in the tablespace in which space is to be acquired in Additional Prerequisites for Constraints and Triggers
More informationnormalization are being violated o Apply the rule of Third Normal Form to resolve a violation in the model
Database Design Section1 - Introduction 1-1 Introduction to the Oracle Academy o Give examples of jobs, salaries, and opportunities that are possible by participating in the Academy. o Explain how your
More informationMore MySQL ELEVEN Walkthrough examples Walkthrough 1: Bulk loading SESSION
SESSION ELEVEN 11.1 Walkthrough examples More MySQL This session is designed to introduce you to some more advanced features of MySQL, including loading your own database. There are a few files you need
More informationKeys are fields in a table which participate in below activities in RDBMS systems:
Keys are fields in a table which participate in below activities in RDBMS systems: 1. To create relationships between two tables. 2. To maintain uniqueness in a table. 3. To keep consistent and valid data
More information