HOW TO CREATE AND MAINTAIN DATABASES AND TABLES. By S. Sabraz Nawaz Senior Lecturer in MIT FMC, SEUSL

Size: px
Start display at page:

Download "HOW TO CREATE AND MAINTAIN DATABASES AND TABLES. By S. Sabraz Nawaz Senior Lecturer in MIT FMC, SEUSL"

Transcription

1 HOW TO CREATE AND MAINTAIN DATABASES AND TABLES By S. Sabraz Nawaz Senior Lecturer in MIT FMC, SEUSL

2 What is SQL? SQL (pronounced "ess-que-el") stands for Structured Query Language. SQL is used to communicate with a database. According to ANSI, it is the standard language for relational database management systems. SQL statements are used to perform tasks such as update data on a database, or retrieve data from a database. Some common relational database management systems that use SQL are: Oracle, Sybase, Microsoft SQL Server, Access, etc. Although most database systems use SQL, most of them also have their own additional proprietary extensions that are usually only used on their system. The standard SQL commands such as "Select", "Insert", "Update", "Delete", "Create", and "Drop" can be used to accomplish almost everything that one needs to do with a database. Main and Functional categories are DML and DDL. Slide 2

3 The SQL statements for data definition You use the data definition language (DDL) statements to create, modify, and delete database objects such as the database itself, the tables contained in a database, and the indexes for those tables. Typically, a database administrator is responsible for using the DDL statements on production databases in a large database system. SQL programmers use these statements to create and work with small databases for testing. In SQL Server, you ll use the Management Studio to generate the DDL statements for you, although you can then verify or correct them as needed. Slide 3

4 SQL DDL Statements Slide 4

5 DDL statements to create database and table Statement CREATE DATABASE CREATE TABLE Description Creates a new database. Creates a new table in the current database. Slide 5

6 Some DDL statements to modify and delete Statement ALTER TABLE DROP DATABASE DROP TABLE Description Modifies the structure of a table. Deletes a database. Deletes a table. Slide 6

7 The basic syntax of the CREATE DATABASE statement CREATE DATABASE database_name How to create a database The CREATE DATABASE statement creates a new, empty database on the current server. The new database is created using the default settings and the database files are stored in the default directory on the hard drive. One of the files SQL Server creates when it executes the CREATE DATABASE statement is a log file. This file is used to record modifications to the database. SQL Server generates the name for the log file by appending _log to the end of the database name. Slide 7

8 Creating, Altering and Deleting databases To create a database CREATE DATABASE Company To rename a database ALTER DATABASE Company MODIFY NAME = NewCompany To delete a database DROP DATABASE NewCompany Slide 8

9 Create Database projects ON (Name=projects, FileName="c:\sqldb\projects.mdf", Size=3, Maxsize = 10, Filegrowth = 2) LOG ON (Name=projects_log, Filename="C:\sqldb\projects_log.ldf", Size=2, Maxsize=3, Filegrowth=1); Slide 9

10 CREATING TABLES Slide 10

11 The basic syntax of the CREATE TABLE statement CREATE TABLE table_name (column_name_1 data_type [column_attributes] [, column_name_2 data_type [column_attributes]]... [, table_attributes]) How to create a table The CREATE TABLE statement creates a table based on the column definitions, column attributes, and table attributes you specify. A table can contain between one and 1024 columns. Each column must have a unique name and must be assigned a data type. In addition, you can assign one or more column attributes to it. You can also assign one or more constraints to a column or to the entire table. Slide 11

12 Data Types Slide 12

13 Data type overview SQL Server defines 26 unique data types that are divided into the four categories shown below. The temporal data types are typically referred to as date/time data types, or simply date data types. The four data type categories Category String Numeric Temporal (date/time) Other Description Strings of character data Integers, floating point numbers, currency, and other numeric data Dates, times, or both Binary data or system pointers Slide 13

14 The numeric data types The integer data types are used to store whole numbers, which are numbers without any digits to the right of the decimal point. The decimal data types are used to store decimal values, which can include digits to the right of the decimal point. The precision of a decimal value indicates the total number of digits that can be stored. The scale of a decimal value indicates the number of digits that can be stored to the right of the decimal point. Slide 14

15 The integer data types Type Bytes Description bigint 8 Large integers from -9,223,372,036,854,775,808 through 9,223,372,036,854,775,807. int 4 Integers from -2,147,483,648 through 2,147,483,647. smallint 2 Small integers from -32,768 through 32,767. tinyint 1 Very small positive integers from 0 through 255. bit 1 Integers with a value of 1 or 0. Slide 15

16 The decimal data types Type Bytes Description decimal[(p[,s])] 5-17 Decimal numbers with fixed precision (p) and scale (s) from through The precision can be any number between 1 and 38; the default is 18. The scale can be any number between 0 and the precision; the default is 0. numeric[(p[,s])] 5-17 Synonymous with decimal. money 8 Monetary values with four decimal places from -922,337,203,685, through 922,337,203,685, Synonymous with decimal(19,4). smallmoney 4 Monetary values with four decimal places from -214, through 214, Synonymous with decimal(10,4). Slide 16

17 The real data types Type Bytes Description float[(n)] 4 or 8 Double-precision floating-point numbers from through n represents the number of bits used to store the decimal portion of the number (the mantissa): n=24 is single-precision; n=53 is double-precision. The default is 53. real 4 Single-precision floating point numbers from through Synonymous with float(24). Slide 17

18 The string data types The string data types can be used to store standard characters that use a single byte of storage or Unicode characters that use two bytes of storage. The char and nchar data types are typically used for fixed-length strings. These data types use the same amount of storage regardless of the actual length of the string. The varchar and nvarchar data types are typically used for variable-length strings. These data types use only the amount of storage needed for a given string. Slide 18

19 The string data types used to store standard characters Type Bytes Description char[(n)] n Fixed-length strings of character data. n is the number of characters between 1 and The default is 1. varchar[(n)] Variable-length strings of character data. n is the maximum number of characters between 1 and The default is 1. The number of bytes used to store the string depends on the actual length of the string. Slide 19

20 The string data types used to store Unicode characters Type Bytes Description nchar(n) 2 n Fixed-length strings of Unicode character data. n is the number of characters between 1 and The default is 1. nvarchar(n) Variable-length strings of Unicode character data. n is the maximum number of characters between 1 and The default is 1. The number of bytes used to store the string depends on the actual length of the string. Two bytes are needed to store each character. Slide 20

21 The temporal (date/time) data types Type Bytes Description datetime 8 Dates and times from January 1, 1753 through December 31, 9999, with an accuracy af 3.33 milliseconds. smalldatetime 4 Dates and times from January 1, 1900 through June 6, 2079, with an accuracy of one minute. Slide 21

22 Common date formats Format Example yyyy-mm-dd mm/dd/yyyy 8/15/2002 mm-dd-yy Month dd, yyyy August 15, 2002 Mon dd, yy Aug 15, 02 dd Mon yy 15 Aug 02 Common time formats Format Example hh:mi 16:20 hh:mi am/pm 4:20 pm hh:mi:ss 4:20:36 hh:mi:ss:mmm 4:20:36:12 Slide 22

23 Column Attributes Slide 23

24 Common column attributes Attribute NULL NOT NULL PRIMARY KEY UNIQUE IDENTITY DEFAULT default_value Description Indicates whether or not the column can accept null values. NULL is the default unless PRIMARY KEY is specified. Identifies the primary key or a unique key for the table. If PRIMARY KEY is specified, the NULL attribute isn t allowed. Identifies an identity column. Only one identity column can be created per table. Specifies a default value for the column. Slide 24

25 An introduction to constraints Constraints are used to enforce the integrity of the data in a table by defining rules about the values that can be stored in the columns of the table. Constraints can be used at the column level to restrict the value of a single column or at the table level to restrict the value of one or more columns. You code a column-level constraint as part of the definition of the column it constrains. You code a table-level constraint as if it were a separate column definition, and you name the columns it constrains within that definition. Constraints are tested before a new row is added to a table or an existing row is updated. The operation succeeds only if the new or modified row meets all of the constraints. Slide 25

26 Column and table constraints Constraint NOT NULL PRIMARY KEY At the column level Prevents null values from being stored in the column. Requires that each row in the table have a unique value in the column. Null values are not allowed. UNIQUE CHECK [FOREIGN KEY] REFERENCES Requires that each row in the table have a unique value in the column. Limits the values for a column. Enforces referential integrity between a column in the new table and a column in a related table. Slide 26

27 Creating a Table Create Database Company Use Company Create Table Employees1 ( ) EmployeeID int identity, FirstName varchar(50) not null, LastName varchar(75) not null, Address varchar(50), HireDate datetime not null, Salary decimal(19,4) not null money data type can be used for Salary column but the money data type is unique to SQL server. So we can use decimal instead. Slide 27

28 Creating a Table Create Table Products1 ( ProductID int not null, Name varchar(255) not null, Price decimal(19,4) not null ) Create Table Sales1 ( SalesID int identity ProductID int not null, EmployeeID int not null, Quantity smallint not null ) Slide 28

29 The Default Clause The DEFAULT clause in the column definition specifies the default value of the column that is, whenever a new row is inserted into the table, the default value for the particular column will be used if there is no value specified for it. Create Table Employees2 ( emp_no int not null, emp_fname varchar(20) not null, emp_lname varchar(20) not null, Datehired smalldatetime default getdate(), dept_no varchar(4) null ) Slide 29

30 The UNIQUE Clause Sometimes more than one column or group of columns of the table have unique values and therefore can be used as the primary key. All columns or groups of columns that qualify to be primary keys are called candidate keys. Each candidate key is defined using the UNIQUE clause in the CREATE TABLE or the ALTER TABLE statement. The UNIQUE clause has the following form: [CONSTRAINT c_name] UNIQUE ({ col_name1},...) Slide 30

31 The UNIQUE Clause Create Table Projects1 ( project_no varchar(4) Default 'p1', project_name varchar(15)not null, Budget decimal(19,4)null, Constraint uniq_proj1 Unique(project_no) ) Slide 31

32 The CHECK Constraint The check constraint specifies conditions for the data inserted into a column. Each row inserted into a table or each value updating the value of the column must meet these conditions. The CHECK clause is used to specify check constraints. The syntax of the CHECK clause is [CONSTRAINT c_name] CHECK expression expression must evaluate to a Boolean value (true or false) and can reference any columns in the current table, but no other tables. Slide 32

33 The CHECK Constraint Create Table Projects2 ( project_no varchar(4) not null, project_name varchar(15) not null, budget decimal(19,4), Constraint prim_proj2 Primary Key(project_no), Constraint chk_bud Check(budget>0) ) Slide 33

34 The CHECK Constraint Create Table Customers1 ( ) cust_id cust_group int not null, varchar(3)null, Constraint prim_cust Primary Key(cust_id), Constraint chk_cust Check(cust_group IN('c1', 'c2','c3')) Slide 34

35 Check for more two columns Create Table Invoices ( InvoiceID int identity, InvoiceTotal decimal(19,4), PaymentTotal decimal(19,4), Constraint check_amount Check((InvoiceTotal > 0) and (PaymentTotal >=0)) ) Slide 35

36 Check for a pattern Create Table Suppliers ( SupplierID varchar(6) primary key, SupplierFName varchar(50) not null, SupplierLName varchar(50) not null, CompanyName varchar(100) not null, Constraint check_id check(supplierid LIKE '[A-Z]''[A-Z]''[0-9]''[0-9]''[0-9]''[0-9]') ) SN0001 Slide 36

37 The PRIMARY KEY Constraint The primary key of a table is a column or group of columns whose value is different in every row. Each primary key is defined using the PRIMARY KEY clause in the CREATE TABLE or the ALTER TABLE statement. The PRIMARY KEY clause has the following form: [CONSTRAINT c_name] PRIMARY KEY ({col_name1},...) All options of the PRIMARY KEY clause have the same meaning as the corresponding options with the same name in the UNIQUE clause. In contrast to UNIQUE, the PRIMARY KEY column must be NOT NULL, and its default value is CLUSTERED. Slide 37

38 Creating a Table Create Table Employees3 ( EmployeeID int PRIMARY KEY, FirstName varchar(50) not null, LastName varchar(75) not null, Address varchar(50), HireDate datetime not null, Salary decimal(19,4) not null ) Create Table Employees4 ( EmployeeID int not null, FirstName varchar(50) not null, LastName varchar(75) not null, Address varchar(50), HireDate datetime not null, Salary decimal(19,4) not null, Constraint PK_Emp Primary Key(EmployeeID) ) Slide 38

39 Two-Column Primary Key Create Table Sales2 ( ) SalesID int identity, ProductID int not null, EmployeeID int not null, Quantity smallint not null, Constraint PK_Sales Primary Key(ProductID, EmployeeID) Note: this is just for illustrative purpose; in real application, these attributes cannot be unique forever (same project and employees might repeat) Slide 39

40 The FOREIGN KEY Constraint A foreign key is a column or group of columns in one table that contains values that match the primary key values in the same or another table. Each foreign key is defined using the FOREIGN KEY clause combined with the REFERENCES clause. The FOREIGN KEY clause has the following form: [CONSTRAINT c_name] [[FOREIGN KEY] ({col_name1},...)] REFERENCES table_name ({col_name2},...) Slide 40

41 [CONSTRAINT c_name] [[FOREIGN KEY] ({col_name1},...)] REFERENCES table_name ({col_name2},...) The FOREIGN KEY clause defines all columns explicitly that belong to the foreign key. The REFERENCES clause specifies the table name with all columns that build the corresponding primary key. The number and the data types of the columns in the FOREIGN KEY clause must match the number and the corresponding data types of columns in the REFERENCES clause Slide 41

42 Foreign Key One Column Create Table Products ( ProductID int primary key, SupplierID varchar(6) not null, Name varchar(255) not null, Price decimal(19,4) not null Constraint fk1 Foreign Key(SupplierID) References Suppliers(SupplierID) ) Slide 42

43 Foreign Key for Two Columns from Two Tables Create Table Invoices2 ( InvoiceID int identity, SupplierID varchar(6) not null, ProductID int, InvoiceTotal decimal(19,4) not null, PaymentTotal decimal(19,4) not null, Constraint fk1 Foreign Key(SupplierID) References Suppliers(SupplierID), Constraint fk2 Foreign Key(ProductID) References Products(ProductID) ) Slide 43

44 Altering and Deleting Tables -- To add columns to the table Employees Alter Table Employees Add ActiveFlag bit not null, ModifiedDate datetime not null Alter Table Products Add newprice money not null -- To modify the data type of a column Alter Table Products Alter Column Price money -- To delete a column in Products table Alter Table Products Drop Column newprice -- To delete the table Employees Drop Table Employees Slide 44

45 More on ALTER TABLE ALTER TABLE Invoices ADD PRIMARY KEY (InvoiceID); ALTER TABLE Invoices ADD FOREIGN KEY (ProductsID) REFERENCES Products(ProductID); ALTER TABLE Invoices ADD CHECK (InvoiceTotal >0); Slide 45

46 Create a Database named EIS and Create Tables with Constraints for the following schema Slide 46

47 Thank You

SQL Functionality SQL. Creating Relation Schemas. Creating Relation Schemas

SQL Functionality SQL. Creating Relation Schemas. Creating Relation Schemas SQL SQL Functionality stands for Structured Query Language sometimes pronounced sequel a very-high-level (declarative) language user specifies what is wanted, not how to find it number of standards original

More information

Lab # 4. Data Definition Language (DDL)

Lab # 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 information

Information Systems Engineering. SQL Structured Query Language DDL Data Definition (sub)language

Information 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 information

Data Definition Language (DDL)

Data Definition Language (DDL) Islamic University of Gaza Faculty of Engineering Computer Engineering Dept. Database Lab (ECOM 4113) Lab 6 Data Definition Language (DDL) Eng. Mohammed Alokshiya November 11, 2014 Database Keys A key

More information

Lab # 2. Data Definition Language (DDL) Eng. Alaa O Shama

Lab # 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 information

Constraints. Primary Key Foreign Key General table constraints Domain constraints Assertions Triggers. John Edgar 2

Constraints. Primary Key Foreign Key General table constraints Domain constraints Assertions Triggers. John Edgar 2 CMPT 354 Constraints Primary Key Foreign Key General table constraints Domain constraints Assertions Triggers John Edgar 2 firstname type balance city customerid lastname accnumber rate branchname phone

More information

EGCI 321: Database Systems. Dr. Tanasanee Phienthrakul

EGCI 321: Database Systems. Dr. Tanasanee Phienthrakul 1 EGCI 321: Database Systems Dr. Tanasanee Phienthrakul 2 Chapter 10 Data Definition Language (DDL) 3 Basic SQL SQL language Considered one of the major reasons for the commercial success of relational

More information

BEGINNING T-SQL. Jen McCown MidnightSQL Consulting, LLC MinionWare, LLC

BEGINNING T-SQL. Jen McCown MidnightSQL Consulting, LLC MinionWare, LLC BEGINNING T-SQL Jen McCown MidnightSQL Consulting, LLC MinionWare, LLC FIRST: GET READY 1. What to model? 2. What is T-SQL? 3. Books Online (BOL) 4. Transactions WHAT TO MODEL? What kind of data should

More information

Basis Data Terapan. Yoannita

Basis Data Terapan. Yoannita Basis Data Terapan Yoannita SQL Server Data Types Character strings: Data type Description Storage char(n) varchar(n) varchar(max) text Fixed-length character string. Maximum 8,000 characters Variable-length

More information

Department 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 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 information

SQL: Data Definition Language

SQL: Data Definition Language SQL: Data Definition Language CSC 343 Winter 2018 MICHAEL LIUT (MICHAEL.LIUT@UTORONTO.CA) DEPARTMENT OF MATHEMATICAL AND COMPUTATIONAL SCIENCES UNIVERSITY OF TORONTO MISSISSAUGA Database Schemas in SQL

More information

Basic SQL. Basic SQL. Basic SQL

Basic SQL. Basic SQL. Basic SQL Basic SQL Dr Fawaz Alarfaj Al Imam Mohammed Ibn Saud Islamic University ACKNOWLEDGEMENT Slides are adopted from: Elmasri & Navathe, Fundamentals of Database Systems MySQL Documentation Basic SQL Structured

More information

user specifies what is wanted, not how to find it

user specifies what is wanted, not how to find it SQL stands for Structured Query Language sometimes pronounced sequel a very-high-level (declarative) language user specifies what is wanted, not how to find it number of standards original ANSI SQL updated

More information

Data Definition Language

Data Definition Language Chapter 5 Data Definition Language In This Chapter c Creating Database Objects c Modifying Database Objects c Removing Database Objects 96 Microsoft SQL Server 2012: A Beginner s Guide This chapter describes

More information

Database Foundations. 6-3 Data Definition Language (DDL) Copyright 2015, Oracle and/or its affiliates. All rights reserved.

Database Foundations. 6-3 Data Definition Language (DDL) Copyright 2015, Oracle and/or its affiliates. All rights reserved. Database Foundations 6-3 Roadmap You are here Introduction to Oracle Application Express Structured Query Language (SQL) Data Definition Language (DDL) Data Manipulation Language (DML) Transaction Control

More information

SQL Structured Query Language Introduction

SQL 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 information

SQL Data Definition and Data Manipulation Languages (DDL and DML)

SQL 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 information

Lesson 05: How to Insert, Update, and Delete Data. By S. Sabraz Nawaz Senior Lecturer in MIT FMC, SEUSL

Lesson 05: How to Insert, Update, and Delete Data. By S. Sabraz Nawaz Senior Lecturer in MIT FMC, SEUSL Lesson 05: How to Insert, Update, and Delete Data By S. Sabraz Nawaz Senior Lecturer in MIT FMC, SEUSL The syntax of the INSERT statement INSERT [INTO] table_name [(column_list)] [DEFAULT] VALUES (expression_1

More information

SQL DATA DEFINITION LANGUAGE

SQL DATA DEFINITION LANGUAGE 9/27/16 DATABASE SCHEMAS IN SQL SQL DATA DEFINITION LANGUAGE SQL is primarily a query language, for getting information from a database. SFWR ENG 3DB3 FALL 2016 But SQL also includes a data-definition

More information

Full file at

Full file at ch2 True/False Indicate whether the statement is true or false. 1. The SQL command to create a database table is an example of DML. 2. A user schema contains all database objects created by a user. 3.

More information

SQL: Concepts. Todd Bacastow IST 210: Organization of Data 2/17/ IST 210

SQL: 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 information

MTAT Introduction to Databases

MTAT Introduction to Databases MTAT.03.105 Introduction to Databases Lecture #3 Data Types, Default values, Constraints Ljubov Jaanuska (ljubov.jaanuska@ut.ee) Lecture 1. Summary SQL stands for Structured Query Language SQL is a standard

More information

Lab 4: Tables and Constraints

Lab 4: Tables and Constraints Lab : Tables and Constraints Objective You have had a brief introduction to tables and how to create them, but we want to have a more in-depth look at what goes into creating a table, making good choices

More information

Basic SQL. Dr Fawaz Alarfaj. ACKNOWLEDGEMENT Slides are adopted from: Elmasri & Navathe, Fundamentals of Database Systems MySQL Documentation

Basic SQL. Dr Fawaz Alarfaj. ACKNOWLEDGEMENT Slides are adopted from: Elmasri & Navathe, Fundamentals of Database Systems MySQL Documentation Basic SQL Dr Fawaz Alarfaj Al Imam Mohammed Ibn Saud Islamic University ACKNOWLEDGEMENT Slides are adopted from: Elmasri & Navathe, Fundamentals of Database Systems MySQL Documentation MIDTERM EXAM 2 Basic

More information

Code Centric: T-SQL Programming with Stored Procedures and Triggers

Code Centric: T-SQL Programming with Stored Procedures and Triggers Apress Books for Professionals by Professionals Sample Chapter: "Data Types" Code Centric: T-SQL Programming with Stored Procedures and Triggers by Garth Wells ISBN # 1-893115-83-6 Copyright 2000 Garth

More information

SQL DATA DEFINITION LANGUAGE

SQL DATA DEFINITION LANGUAGE SQL DATA DEFINITION LANGUAGE DATABASE SCHEMAS IN SQL SQL is primarily a query language, for getting information from a database. DML: Data Manipulation Language SFWR ENG 3DB3 FALL 2016 MICHAEL LIUT (LIUTM@MCMASTER.CA)

More information

Private Institute of Aga NETWORK DATABASE LECTURER NIYAZ M. SALIH

Private 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 information

Database and table creation

Database 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 information

SQL Server 2008 Tutorial 3: Database Creation

SQL 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 information

Exact Numeric Data Types

Exact 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 information

CST272 SQL Server, SQL and the SqlDataSource Page 1

CST272 SQL Server, SQL and the SqlDataSource Page 1 CST272 SQL Server, SQL and the SqlDataSource Page 1 1 2 3 4 5 6 7 8 9 SQL Server, SQL and the SqlDataSource CST272 ASP.NET Microsoft SQL Server A relational database server developed by Microsoft Stores

More information

SQL Fundamentals. Chapter 3. Class 03: SQL Fundamentals 1

SQL 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 information

Database Management Systems,

Database Management Systems, Database Management Systems SQL Query Language (1) 1 Topics Introduction SQL History Domain Definition Elementary Domains User-defined Domains Creating Tables Constraint Definition INSERT Query SELECT

More information

SQL Data Definition Language

SQL Data Definition Language SQL Data Definition Language André Restivo 1 / 56 Index Introduction Table Basics Data Types Defaults Constraints Check Not Null Primary Keys Unique Keys Foreign Keys Sequences 2 / 56 Introduction 3 /

More information

SQL DATA DEFINITION LANGUAGE

SQL DATA DEFINITION LANGUAGE SQL DATA DEFINITION LANGUAGE DATABASE SCHEMAS IN SQL SQL is primarily a query language, for getting information from a database. DML: Data Manipulation Language SFWR ENG 3DB3 FALL 2016 MICHAEL LIUT (LIUTM@MCMASTER.CA)

More information

How to use SQL to create a database

How to use SQL to create a database Chapter 17 How to use SQL to create a database How to create a database CREATE DATABASE my_guitar_shop2; How to create a database only if it does not exist CREATE DATABASE IF NOT EXISTS my_guitar_shop2;

More information

Database Foundations. 6-4 Data Manipulation Language (DML) Copyright 2015, Oracle and/or its affiliates. All rights reserved.

Database Foundations. 6-4 Data Manipulation Language (DML) Copyright 2015, Oracle and/or its affiliates. All rights reserved. Database Foundations 6-4 Roadmap You are here Introduction to Oracle Application Express Structured Query Language (SQL) Data Definition Language (DDL) Data Manipulation Language (DML) Transaction Control

More information

D B M G. SQL language: basics. Managing tables. Creating a table Modifying table structure Deleting a table The data dictionary Data integrity

D B M G. SQL language: basics. Managing tables. Creating a table Modifying table structure Deleting a table The data dictionary Data integrity SQL language: basics Creating a table Modifying table structure Deleting a table The data dictionary Data integrity 2013 Politecnico di Torino 1 Creating a table Creating a table (1/3) The following SQL

More information

Department of Computer Science University of Cyprus. EPL342 Databases. Lab 2

Department 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 information

Creating Tables, Defining Constraints. Rose-Hulman Institute of Technology Curt Clifton

Creating Tables, Defining Constraints. Rose-Hulman Institute of Technology Curt Clifton Creating Tables, Defining Constraints Rose-Hulman Institute of Technology Curt Clifton Outline Data Types Creating and Altering Tables Constraints Primary and Foreign Key Constraints Row and Tuple Checks

More information

Chapter 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 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 information

Unit 1 - Chapter 4,5

Unit 1 - Chapter 4,5 Unit 1 - Chapter 4,5 CREATE DATABASE DatabaseName; SHOW DATABASES; USE DatabaseName; DROP DATABASE DatabaseName; CREATE TABLE table_name( column1 datatype, column2 datatype, column3 datatype,... columnn

More information

COSC344 Database Theory and Applications. Lecture 5 SQL - Data Definition Language. COSC344 Lecture 5 1

COSC344 Database Theory and Applications. Lecture 5 SQL - Data Definition Language. COSC344 Lecture 5 1 COSC344 Database Theory and Applications Lecture 5 SQL - Data Definition Language COSC344 Lecture 5 1 Overview Last Lecture Relational algebra This Lecture Relational algebra (continued) SQL - DDL CREATE

More information

Lab # 2 Hands-On. DDL Basic SQL Statements Institute of Computer Science, University of Tartu, Estonia

Lab # 2 Hands-On. DDL Basic SQL Statements Institute of Computer Science, University of Tartu, Estonia Lab # 2 Hands-On DDL Basic SQL Statements Institute of Computer Science, University of Tartu, Estonia Part A: Demo by Instructor in Lab a. Data type of MySQL b. CREATE table c. ALTER table (ADD, CHANGE,

More information

Oracle SQL Developer. Supplementary Information for Microsoft SQL Server and Sybase Adaptive Server Migrations Release 2.

Oracle SQL Developer. Supplementary Information for Microsoft SQL Server and Sybase Adaptive Server Migrations Release 2. Oracle SQL Developer Supplementary Information for Microsoft SQL Server and Sybase Adaptive Server Migrations Release 2.1 E15226-01 December 2009 This document contains information for migrating from Microsoft

More information

Full file at

Full file at SQL for SQL Server 1 True/False Questions Chapter 2 Creating Tables and Indexes 1. In order to create a table, three pieces of information must be determined: (1) the table name, (2) the column names,

More information

COMP 430 Intro. to Database Systems

COMP 430 Intro. to Database Systems SELECT name FROM sqlite_master WHERE type='table' COMP 430 Intro. to Database Systems Single-table SQL Get clickers today! Slides use ideas from Chris Ré and Chris Jermaine. Clicker test Have you used

More information

WHAT IS SQL. Database query language, which can also: Define structure of data Modify data Specify security constraints

WHAT IS SQL. Database query language, which can also: Define structure of data Modify data Specify security constraints SQL KEREM GURBEY WHAT IS SQL Database query language, which can also: Define structure of data Modify data Specify security constraints DATA DEFINITION Data-definition language (DDL) provides commands

More information

Course Topics. Microsoft SQL Server. Dr. Shohreh Ajoudanian. 01 Installing MSSQL Server Data types

Course Topics. Microsoft SQL Server. Dr. Shohreh Ajoudanian. 01 Installing MSSQL Server Data types Dr. Shohreh Ajoudanian Course Topics Microsoft SQL Server 01 Installing MSSQL Server 2008 03 Creating a database 05 Querying Tables with SELECT 07 Using Set Operators 02 Data types 04 Creating a table,

More information

Introduction to SQL Server 2005/2008 and Transact SQL

Introduction to SQL Server 2005/2008 and Transact SQL Introduction to SQL Server 2005/2008 and Transact SQL Week 4: Normalization, Creating Tables, and Constraints Some basics of creating tables and databases Steve Stedman - Instructor Steve@SteveStedman.com

More information

BASIC SQL CHAPTER 4 (6/E) CHAPTER 8 (5/E)

BASIC SQL CHAPTER 4 (6/E) CHAPTER 8 (5/E) 1 BASIC SQL CHAPTER 4 (6/E) CHAPTER 8 (5/E) 2 LECTURE OUTLINE SQL Data Definition and Data Types Specifying Constraints in SQL Basic Retrieval Queries in SQL Set Operations in SQL 3 BASIC SQL Structured

More information

COSC 304 Introduction to Database Systems SQL DDL. Dr. Ramon Lawrence University of British Columbia Okanagan

COSC 304 Introduction to Database Systems SQL DDL. Dr. Ramon Lawrence University of British Columbia Okanagan COSC 304 Introduction to Database Systems SQL DDL Dr. Ramon Lawrence University of British Columbia Okanagan ramon.lawrence@ubc.ca SQL Overview Structured Query Language or SQL is the standard query language

More information

CSCC43H: Introduction to Databases. Lecture 4

CSCC43H: Introduction to Databases. Lecture 4 CSCC43H: Introduction to Databases Lecture 4 Wael Aboulsaadat Acknowledgment: these slides are partially based on Prof. Garcia-Molina & Prof. Ullman slides accompanying the course s textbook. CSCC43: Introduction

More information

DS Introduction to SQL Part 1 Single-Table Queries. By Michael Hahsler based on slides for CS145 Introduction to Databases (Stanford)

DS Introduction to SQL Part 1 Single-Table Queries. By Michael Hahsler based on slides for CS145 Introduction to Databases (Stanford) DS 1300 - Introduction to SQL Part 1 Single-Table Queries By Michael Hahsler based on slides for CS145 Introduction to Databases (Stanford) Overview 1. SQL introduction & schema definitions 2. Basic single-table

More information

Item: 1 (Ref:Cert-1Z )

Item: 1 (Ref:Cert-1Z ) Page 1 of 13 Item: 1 (Ref:Cert-1Z0-071.10.2.1) Evaluate this CREATE TABLE statement: CREATE TABLE customer ( customer_id NUMBER, company_id VARCHAR2(30), contact_name VARCHAR2(30), contact_title VARCHAR2(20),

More information

MIT Database Management Systems

MIT Database Management Systems MIT 22033 Database Management Systems Lesson 04: How to retrieve data from two or more tables By S. Sabraz Nawaz Senior Lecturer in MIT FMC, SEUSL How to code an inner join A join is used to combine columns

More information

Chapter # 7 Introduction to Structured Query Language (SQL) Part I

Chapter # 7 Introduction to Structured Query Language (SQL) Part I Chapter # 7 Introduction to Structured Query Language (SQL) Part I Introduction to SQL SQL functions fit into two broad categories: Data definition language Data manipulation language Basic command set

More information

MySQL Introduction. By Prof. B.A.Khivsara

MySQL Introduction. By Prof. B.A.Khivsara MySQL Introduction By Prof. B.A.Khivsara Note: The material to prepare this presentation has been taken from internet and are generated only for students reference and not for commercial use. Outline Design

More information

Chapter 4. Basic SQL. SQL Data Definition and Data Types. Basic SQL. SQL language SQL. Terminology: CREATE statement

Chapter 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 information

BASIC SQL CHAPTER 4 (6/E) CHAPTER 8 (5/E)

BASIC SQL CHAPTER 4 (6/E) CHAPTER 8 (5/E) 1 BASIC SQL CHAPTER 4 (6/E) CHAPTER 8 (5/E) 2 CHAPTER 4 OUTLINE SQL Data Definition and Data Types Specifying Constraints in SQL Basic Retrieval Queries in SQL Set Operations in SQL 3 BASIC SQL Structured

More information

Using DDL Statements to Create and Manage Tables. Copyright 2006, Oracle. All rights reserved.

Using DDL Statements to Create and Manage Tables. Copyright 2006, Oracle. All rights reserved. Using DDL Statements to Create and Manage Tables Objectives After completing this lesson, you should be able to do the following: Categorize the main database objects Review the table structure List the

More information

SQL Data Definition: Table Creation

SQL Data Definition: Table Creation SQL Data Definition: Table Creation ISYS 464 Spring 2002 Topic 11 Student Course Database Student (Student Number, Student Name, Major) Course (Course Number, Course Name, Day, Time) Student Course (Student

More information

Physical Design of Relational Databases

Physical 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 information

Every Byte Counts. Why Datatype Choices Matter. Andy Yun, Database Architect/Developer

Every Byte Counts. Why Datatype Choices Matter. Andy Yun, Database Architect/Developer Every Byte Counts Why Datatype Choices Matter Andy Yun, Database Architect/Developer Thank You Presenting Sponsors Gain insights through familiar tools while balancing monitoring and managing user created

More information

Introduction to SQL. IT 5101 Introduction to Database Systems. J.G. Zheng Fall 2011

Introduction to SQL. IT 5101 Introduction to Database Systems. J.G. Zheng Fall 2011 Introduction to SQL IT 5101 Introduction to Database Systems J.G. Zheng Fall 2011 Overview Using Structured Query Language (SQL) to get the data you want from relational databases Learning basic syntax

More information

Introduction to SQL on GRAHAM ED ARMSTRONG SHARCNET AUGUST 2018

Introduction to SQL on GRAHAM ED ARMSTRONG SHARCNET AUGUST 2018 Introduction to SQL on GRAHAM ED ARMSTRONG SHARCNET AUGUST 2018 Background Information 2 Background Information What is a (Relational) Database 3 Dynamic collection of information. Organized into tables,

More information

System Pages (Setup Admins Only)

System 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 information

SQL: Data De ni on. B0B36DBS, BD6B36DBS: Database Systems. h p://www.ksi.m.cuni.cz/~svoboda/courses/172-b0b36dbs/ Lecture 3

SQL: 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 information

CS2300: File Structures and Introduction to Database Systems

CS2300: File Structures and Introduction to Database Systems CS2300: File Structures and Introduction to Database Systems Lecture 14: SQL Doug McGeehan From Theory to Practice The Entity-Relationship Model: a convenient way of representing the world. The Relational

More information

1. SQL Overview. Allows users to access data in the relational database management systems.

1. SQL Overview. Allows users to access data in the relational database management systems. 1. Overview is a language to operate databases; it includes database creation, deletion, fetching rows, modifying rows, etc. is an ANSI (American National Standards Institute) standard language, but there

More information

COGS 121 HCI Programming Studio. Week 03 - Tech Lecture

COGS 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 information

Copyright 2016 Ramez Elmasri and Shamkant B. Navathe

Copyright 2016 Ramez Elmasri and Shamkant B. Navathe CHAPTER 6 Basic SQL Slide 6-2 Chapter 6 Outline SQL Data Definition and Data Types Specifying Constraints in SQL Basic Retrieval Queries in SQL INSERT, DELETE, and UPDATE Statements in SQL Additional Features

More information

SQL Data Definition Language: Create and Change the Database Ray Lockwood

SQL 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 information

Queries. Chapter 6. In This Chapter. c SELECT Statement: Its Clauses and Functions. c Join Operator c Correlated Subqueries c Table Expressions

Queries. Chapter 6. In This Chapter. c SELECT Statement: Its Clauses and Functions. c Join Operator c Correlated Subqueries c Table Expressions Chapter 6 Queries In This Chapter c SELECT Statement: Its Clauses and Functions c Subqueries c Temporary Tables c Join Operator c Correlated Subqueries c Table Expressions 136 Microsoft SQL Server 2012:

More information

ACCESS isn t only a great development tool it s

ACCESS isn t only a great development tool it s Upsizing Access to Oracle Smart Access 2000 George Esser In addition to showing you how to convert your Access prototypes into Oracle systems, George Esser shows how your Access skills translate into Oracle.

More information

Creating and Managing Tables Schedule: Timing Topic

Creating and Managing Tables Schedule: Timing Topic 9 Creating and Managing Tables Schedule: Timing Topic 30 minutes Lecture 20 minutes Practice 50 minutes Total Objectives After completing this lesson, you should be able to do the following: Describe the

More information

Project Database Rules

Project Database Rules Company Header Project Database Rules Author: Contributors: Signed Off: Table of Contents Introduction... 3 Database object naming conventions... 3 1. Tables... 3 2. Columns... 4 3. Indexes... 5 4. Constraints...

More information

Compression Users Guide. Adaptive Server Enterprise 15.7

Compression Users Guide. Adaptive Server Enterprise 15.7 Compression Users Guide Adaptive Server Enterprise 15.7 DOCUMENT ID: DC01667-01-1570-01 LAST REVISED: September 2011 Copyright 2011 by Sybase, Inc. All rights reserved. This publication pertains to Sybase

More information

C Examcollection.Premium.Exam.58q

C Examcollection.Premium.Exam.58q C2090-610.Examcollection.Premium.Exam.58q Number: C2090-610 Passing Score: 800 Time Limit: 120 min File Version: 32.2 http://www.gratisexam.com/ Exam Code: C2090-610 Exam Name: DB2 10.1 Fundamentals Visualexams

More information

1) Introduction to SQL

1) Introduction to SQL 1) Introduction to SQL a) Database language enables users to: i) Create the database and relation structure; ii) Perform insertion, modification and deletion of data from the relationship; and iii) Perform

More information

12 Rules Defined by Dr.Codd for a Relational Database Management System

12 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 information

Tables From Existing Tables

Tables From Existing Tables Creating Tables From Existing Tables After completing this module, you will be able to: Create a clone of an existing table. Create a new table from many tables using a SQL SELECT. Define your own table

More information

3ISY402 DATABASE SYSTEMS

3ISY402 DATABASE SYSTEMS 3ISY402 DATABASE SYSTEMS - SQL: Data Definition 1 Leena Gulabivala Material from essential text: T CONNOLLY & C BEGG. Database Systems A Practical Approach to Design, Implementation and Management, 4th

More information

Islamic University of Gaza Faculty of Engineering Department of Computer Engineering Fall 2011 ECOM 4113: Database System Lab Eng.

Islamic University of Gaza Faculty of Engineering Department of Computer Engineering Fall 2011 ECOM 4113: Database System Lab Eng. Islamic University of Gaza Faculty of Engineering Department of Computer Engineering Fall 2011 ECOM 4113: Database System Lab Eng. Ahmed Abumarasa Database Lab Lab 2 Database Table Introduction: The previous

More information

Draft. Students Table. FName LName StudentID College Year. Justin Ennen Science Senior. Dan Bass Management Junior

Draft. Students Table. FName LName StudentID College Year. Justin Ennen Science Senior. Dan Bass Management Junior Chapter 6 Introduction to SQL 6.1 What is a SQL? When would I use it? SQL stands for Structured Query Language. It is a language used mainly for talking to database servers. It s main feature divisions

More information

Exam code: Exam name: Database Fundamentals. Version 16.0

Exam 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 information

After completing this unit, you should be able to: Define the terms

After completing this unit, you should be able to: Define the terms Introduction Copyright IBM Corporation 2007 Course materials may not be reproduced in whole or in part without the prior written permission of IBM. 4.0.3 3.3.1 Unit Objectives After completing this unit,

More information

Lecture7: SQL Overview, Oracle Data Type, DDL and Constraints Part #2

Lecture7: SQL Overview, Oracle Data Type, DDL and Constraints Part #2 IS220 : Database Fundamentals College of Computer and Information Sciences - Information Systems Dept. Lecture7: SQL Overview, Oracle Data Type, DDL and Constraints Part #2 Ref. Chapter6 Prepared by L.

More information

Information Systems for Engineers Fall Data Definition with SQL

Information Systems for Engineers Fall Data Definition with SQL Ghislain Fourny Information Systems for Engineers Fall 2018 3. Data Definition with SQL Rare Book and Manuscript Library, Columbia University. What does data look like? Relations 2 Reminder: relation 0

More information

Outline. Textbook Chapter 6. Note 1. CSIE30600/CSIEB0290 Database Systems Basic SQL 2

Outline. Textbook Chapter 6. Note 1. CSIE30600/CSIEB0290 Database Systems Basic SQL 2 Outline SQL Data Definition and Data Types Specifying Constraints in SQL Basic Retrieval Queries in SQL INSERT, DELETE, and UPDATE Statements in SQL Additional Features of SQL Textbook Chapter 6 CSIE30600/CSIEB0290

More information

SQL: DDL. John Ortiz Cs.utsa.edu

SQL: DDL. John Ortiz Cs.utsa.edu SQL: DDL John Ortiz Cs.utsa.edu SQL Data Definition Language Used by DBA or Designer to specify schema A set of statements used to define and to change the definition of tables, columns, data types, constraints,

More information

5. SQL Query Syntax 1. Select Statement. 6. CPS: Database Schema

5. SQL Query Syntax 1. Select Statement. 6. CPS: Database Schema 5. SQL Query Syntax 1. Select Statement 6. CPS: Database Schema Joined in 2016 Previously IT Manager at RSNWO in Northwest Ohio AAS in Computer Programming A+ Certification in 2012 Microsoft Certified

More information

An Introduction to Structured Query Language

An Introduction to Structured Query Language An Introduction to Structured Query Language Alexandra Roatiş David R. Cheriton School of Computer Science University of Waterloo CS 348 Introduction to Database Management Winter 2016 CS 348 SQL Winter

More information

SQL. Rodrigo García Carmona Universidad San Pablo-CEU Escuela Politécnica Superior

SQL. Rodrigo García Carmona Universidad San Pablo-CEU Escuela Politécnica Superior SQL Rodrigo García Carmona Universidad San Pablo-CEU Escuela Politécnica Superior 1 DDL 2 DATA TYPES All columns must have a data type. The most common data types in SQL are: Alphanumeric: Fixed length:

More information

2.9 Table Creation. CREATE TABLE TableName ( AttrName AttrType, AttrName AttrType,... )

2.9 Table Creation. CREATE TABLE TableName ( AttrName AttrType, AttrName AttrType,... ) 2.9 Table Creation CREATE TABLE TableName ( AttrName AttrType, AttrName AttrType,... ) CREATE TABLE Addresses ( id INTEGER, name VARCHAR(20), zipcode CHAR(5), city VARCHAR(20), dob DATE ) A list of valid

More information

Lesson 06 Arrays. MIT 11053, Fundamentals of Programming By: S. Sabraz Nawaz Senior Lecturer in MIT Department of MIT FMC, SEUSL

Lesson 06 Arrays. MIT 11053, Fundamentals of Programming By: S. Sabraz Nawaz Senior Lecturer in MIT Department of MIT FMC, SEUSL Lesson 06 Arrays MIT 11053, Fundamentals of Programming By: S. Sabraz Nawaz Senior Lecturer in MIT Department of MIT FMC, SEUSL Array An array is a group of variables (called elements or components) containing

More information

Lecture7: SQL Overview, Oracle Data Type, DDL and Constraints Part #2

Lecture7: SQL Overview, Oracle Data Type, DDL and Constraints Part #2 Lecture7: SQL Overview, Oracle Data Type, DDL and Constraints Part #2 Ref. Chapter6 Prepared by L. Nouf Almujally & Aisha AlArfaj& L.Fatima Alhayan Colleg Comp Informa Scien Informa Syst D 1 IS220 : Database

More information

Chapter 11 How to create databases, tables, and indexes

Chapter 11 How to create databases, tables, and indexes Chapter 11 How to create databases, tables, and indexes Murach's MySQL, C11 2015, Mike Murach & Associates, Inc. Slide 1 Objectives Applied Given the design for a database, write the DDL statements to

More information

Introduction to SQL Part 1 By Michael Hahsler based on slides for CS145 Introduction to Databases (Stanford)

Introduction to SQL Part 1 By Michael Hahsler based on slides for CS145 Introduction to Databases (Stanford) Introduction to SQL Part 1 By Michael Hahsler based on slides for CS145 Introduction to Databases (Stanford) Lecture 2 Lecture Overview 1. SQL introduction & schema definitions 2. Basic single-table queries

More information

University College of Southeast Norway. Introduction to Database. Systems. Hans-Petter Halvorsen,

University College of Southeast Norway. Introduction to Database. Systems. Hans-Petter Halvorsen, University College of Southeast Norway Introduction to Database Hans-Petter Halvorsen, 2016.11.01 Systems http://home.hit.no/~hansha Preface This document explains the basic concepts of a database system

More information