Basic SQL types String –Char(n): fixed length. Padded –Varchar(n): variable length Number –Integer: 32 bit –Decimal(5,2): 999.99 –Real, Double: 32 bit,

Slides:



Advertisements
Similar presentations
CIT 613: Relational Database Development using SQL Revision of Tables and Data Types.
Advertisements

Database Design -- Basic SQL
SQL’s Data Definition Language (DDL) n DDL statements define, modify and remove objects from data dictionary tables maintained by the DBMS n Whenever you.
Day 3 - Basics of MySQL What is MySQL What is MySQL How to make basic tables How to make basic tables Simple MySQL commands. Simple MySQL commands.
Structured Query Language - SQL Carol Wolf Computer Science.
Representing Data Elements Gayatri Gopalakrishnan.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 4 SQL: Data Definition, Constraints, and Basic Queries and Updates.
Fall 2001Arthur Keller – CS 1808–1 Schedule Today Oct. 18 (TH) Schemas, Views. u Read Sections u Project Part 3 extended to Oct. 23 (T). Oct.
CIT 381 Data Types - data types - create table statement - constraints.
Winter 2002Arthur Keller – CS 1808–1 Schedule Today: Jan. 29 (T) u Modifications, Schemas, Views. u Read Sections Assignment 3 due. Jan. 31 (TH)
©Silberschatz, Korth and Sudarshan4.1Database System Concepts Modification of the Database – Deletion Delete all account records at the Perryridge branch.
13.5 Representing Data Elements Fields, Records, Blocks Variable-length Data Modifying Records.
Murali Mani SQL DDL and Oracle utilities. Murali Mani Datatypes in SQL INT (or) INTEGER FLOAT (or) REAL DECIMAL (n, m) CHAR (n) VARCHAR (n) DATE, TIME.
Student(sid, name, addr, age, GPA) Class(dept, cnum, sec, unit, title, instructor) Enroll(sid, dept, cnum, sec) siddeptcnumsec 301CS CS AT00000.
Chapter 12 Representing Data Elements By Yue Lu CS257 Spring 2008 Instructor: Dr.Lin.
SQL Overview Defining a Schema CPSC 315 – Programming Studio Spring 2008 Project 1, Lecture 3 Slides adapted from those used by Jeffrey Ullman, via Jennifer.
Database Management System LICT 3011 Eyad H. Elshami.
Correlated Queries SELECT title FROM Movie AS Old WHERE year < ANY (SELECT year FROM Movie WHERE title = Old.title); Movie (title, year, director, length)
SQL Overview Defining a Schema CPSC 315 – Programming Studio Slides adapted from those used by Jeffrey Ullman, via Jennifer Welch Via Yoonsuck Choe.
Copyright © Curt Hill SQL The Data Definition Language.
Structured Query Language (SQL) A2 Teacher Up skilling LECTURE 2.
CSE314 Database Systems Lecture 4 Basic SQL Doç. Dr. Mehmet Göktürk src: Elmasri & Navanthe 6E Pearson Ed Slide Set.
Irwin/McGraw-Hill Copyright © 2000 The McGraw-Hill Companies. All Rights reserved Whitten Bentley DittmanSYSTEMS ANALYSIS AND DESIGN METHODS5th Edition.
SQL Data Definition (CB Chapter 6) CPSC 356 Database Ellen Walker Hiram College (Includes figures from Database Systems by Connolly & Begg, © Addison Wesley.
CS 3630 Database Design and Implementation. Your Oracle Account UserName is the same as your UWP username Followed Not case sensitive Initial.
1 The Relational Model Instructor: Mohamed Eltabakh
Chapter 8 Part 1 SQL-99 Schema Definition, Constraints, Queries, and Views.
Ms. Hatoon Al-Sagri CCIS – IS Department SQL-99 :Schema Definition, Constraints, Queries, and Views 1.
Chapter 7 SQL HUANG XUEHUA. SQL SQL server2005 introduction Install components  management studio.
Winter 2006Keller Ullman Cushing8–1 Turning in Assignments Please turn in hard copy (use only in the direst of circumstances). I am not your secretary.
SQL Data Definition Language (DDL) Using Microsoft SQL Server 1SDL Data Definition Language (DDL)
SQL SQL Server : Overview SQL : Overview Types of SQL Database : Creation Tables : Creation & Manipulation Data : Creation & Manipulation Data : Retrieving.
1 SQL Tarek El-Shishtawy Professor Ass. Of Computer Engineering.
Data Definition After this lecture, you should be able to:
SQL: DDL John Ortiz Cs.utsa.edu.
Entity-Relationship (ER) Modelling ER modelling - Identify entities - Identify relationships - Construct ER diagram - Collect attributes for entities &
SCUHolliday - coen 1788–1 Schedule Today u Modifications, Schemas, Views. u Read Sections (except and 6.6.6) Next u Constraints. u Read.
SQL Fundamentals  SQL: Structured Query Language is a simple and powerful language used to create, access, and manipulate data and structure in the database.
Advanced Database CS-426 Week 1 - Introduction. Database Management System DBMS contains information about a particular enterprise Collection of interrelated.
MySQL More… 1. More on SQL In MySQL, the Information Schema is the “Catalog” in the SQL standard SQL has three components: Data definition Data manipulation.
Prince Sultan University Dept. of Computer & Information Sciences CS 340 Introduction to Database Systems.
Chapter 6 SQL. Agenda Data Definition Language (DDL) Access Control.
Lu Chaojun, SJTU Relational Data Model 1. Lu Chaojun, SJTU What’s a Data Model? A notation (collection of conceptual tools) for describing data as seen.
CMPT 258 Database Systems The Relationship Model (Chapter 3)
Week 8-9 SQL-1. SQL Components: DDL, DCL, & DML SQL is a very large and powerful language, but every type of SQL statement falls within one of three main.
©Silberschatz, Korth and Sudarshan1 Structured Query Language (SQL) Data Definition Language Domains Integrity Constraints.
1 CS 430 Database Theory Winter 2005 Lecture 10: Introduction to SQL.
1 CS 430 Database Theory Winter 2005 Lecture 11: SQL DDL.
SQL. What is a database? G a collection of data G Usually consists of entities and relations G An entity is an individual “object” that exists and is.
الفصل السادس لغة Structured Query Language) SQL الفصل السادس لغة Structured Query Language) SQL.
Lecture # 24 Introduction to SQL Muhammad Emran Database Systems.
Physical Model Lecture 11. Physical Data Model The last step is the physical design phase, In this phase data is – Store – Organized and – Access.
CPSC-310 Database Systems
Chapter 3 Introduction to SQL
Relational Data Model Lu Chaojun, SJTU.
Data Definition and Data Types
CS 480: Database Systems Lecture 13 February 13,2013.
Data Definition and Data Types
Database Models Relational Model
Working with Data Types
SQL OVERVIEW DEFINING A SCHEMA
Defining a Database Schema
SQL-1 Week 8-9.
Session - 6 Sequence - 1 SQL: The Structured Query Language:
CS3220 Web and Internet Programming SQL and MySQL
MySQL Database System Installation Overview SQL summary
CS3220 Web and Internet Programming SQL and MySQL
Session - 6 Sequence - 1 SQL: The Structured Query Language:
CMSC-461 Database Management Systems
SQL (Structured Query Language)
Presentation transcript:

Basic SQL types String –Char(n): fixed length. Padded –Varchar(n): variable length Number –Integer: 32 bit –Decimal(5,2): –Real, Double: 32 bit, 64 bit Datetime –Date: ‘ ’ –Time: ’13:40:00’ –Timestamp: ‘ :40:00’

Schema definition (table creation) Course(dept,cnum,sec,unit,instructor,title) CREATE TABLE Course ( dept CHAR(2) NOT NULL, cnum INTEGER NOT NULL, sec INTEGER NOT NULL, unit INTEGER, instructor VARCHAR(30), title VARCHAR(30), PRIMARY KEY(dept, cnum, sec) )

Schema definition (table creation) Course(dept,cnum,sec,unit,instructor,title) CREATE TABLE Course ( dept CHAR(2) NOT NULL DEFAULT ‘CS’, cnum INTEGER NOT NULL, sec INTEGER NOT NULL, unit INTEGER, instructor VARCHAR(30), title VARCHAR(30) DEFAULT, PRIMARY KEY(dept, cnum, sec) UNIQUE(dept, cnum, instructor), UNIQUE(dept, sec, title) )