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

Slides:



Advertisements
Similar presentations
9 Copyright © 2004, Oracle. All rights reserved. Using DDL Statements to Create and Manage Tables.
Advertisements

Session 2Introduction to Database Technology Data Types and Table Creation.
9 Creating and Managing Tables. Objectives After completing this lesson, you should be able to do the following: Describe the main database objects Create.
Data Definition Language (DDL)
Creating Tables. 2 home back first prev next last What Will I Learn? List and provide an example of each of the number, character, and date data types.
Creating an Oracle Database Table Additional information is available in speaker notes!
Database Chapters.
Chapter 3 : Relational Model
Database Management Systems, R. Ramakrishnan and J. Gehrke1 The Relational Model Chapter 3.
Database Basics I101 Summer 2006 Copyright 2004, Matt Hottell.
CMPT 354, Simon Fraser University, Fall 2008, Martin Ester 28 Database Systems I The Relational Data Model.
Sanjay Goel, School of Business, University at Albany, SUNY 1 SQL- Data Definition Language ITM 692 Sanjay Goel.
Representing Data Elements Gayatri Gopalakrishnan.
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.
Winter 2002Arthur Keller – CS 1808–1 Schedule Today: Jan. 29 (T) u Modifications, Schemas, Views. u Read Sections Assignment 3 due. Jan. 31 (TH)
Basic SQL types String –Char(n): fixed length. Padded –Varchar(n): variable length Number –Integer: 32 bit –Decimal(5,2): –Real, Double: 32 bit,
Winter 2002Judy Cushing8–1 Schedule Jan. 30 (Wed) u Modifications, Schemas, Views. Read Sections This Week (Feb 4ff) u Constraints Read Sections.
1 Relational Model. 2 Relational Database: Definitions  Relational database: a set of relations  Relation: made up of 2 parts: – Instance : a table,
13.5 Representing Data Elements Fields, Records, Blocks Variable-length Data Modifying Records.
DT211 Stage 2 Databases Lab 1. Get to know SQL Server SQL server has 2 parts: –A client, running on your machine, in the lab. You access the database.
DATABASES AND SQL. Introduction Relation: Relation means table(data is arranged in rows and columns) Domain : A domain is a pool of values appearing in.
Your Oracle Account UserName is the same as your UWP username Followed Not case sensitive Initial Password: UWPstudent Password is case sensitive.
Introduction To Databases IDIA 618 Fall 2014 Bridget M. Blodgett.
Structured Query Language (SQL) A2 Teacher Up skilling LECTURE 2.
Relational Data Model, R. Ramakrishnan and J. Gehrke with Dr. Eick’s additions 1 The Relational Model Chapter 3.
CS 3630 Database Design and Implementation. Your Oracle Account UserName is the same as your UWP username Followed Not case sensitive Initial.
CHAPTER:14 Simple Queries in SQL Prepared By Prepared By : VINAY ALEXANDER ( विनय अलेक्सजेंड़र ) PGT(CS),KV JHAGRAKHAND.
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.
© 2007 by Prentice Hall3-1 Introduction to Oracle 10g Chapter 3 Creating, Modifying, Renaming, and Deleting Database Tables James Perry and Gerald Post.
Chapter 4 Introduction to MySQL. MySQL “the world’s most popular open-source database application” “commonly used with PHP”
Chapter 5: Part 1: DDL STRUCTURED QUERY LANGUAGE (SQL)
1 Structured Query Language (SQL). 2 Contents SQL – I SQL – II SQL – III SQL – IV.
1 The Relational Model. 2 Why Study the Relational Model? v Most widely used model. – Vendors: IBM, Informix, Microsoft, Oracle, Sybase, etc. v “Legacy.
FALL 2004CENG 351 File Structures and Data Management1 Relational Model Chapter 3.
SCUHolliday - coen 1788–1 Schedule Today u Modifications, Schemas, Views. u Read Sections (except and 6.6.6) Next u Constraints. u Read.
Topic 1: Introduction to SQL. SQL stands for Structured Query Language. SQL is a standard computer language for accessing and manipulating databases SQL.
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.
Visual Programing SQL Overview Section 1.
Conversion Functions.
Data types  CHAR (size): This data type is used to store character strings values of fixed length. The size in brackets determines the number of characters.
SQL CREATING AND MANAGING TABLES lecture4 1. Database Objects ObjectDescription TableBasic unit of storage; composed of rows and columns ViewLogically.
Sql DDL queries CS 260 Database Systems.
Table Creation / Data Types. A Data type is... Specifies what kind of information a column will hold so that the system will know how the data is to be.
ITS232 Introduction To Database Management Systems Siti Nurbaya Ismail Faculty of Computer Science & Mathematics, Universiti Teknologi MARA (UiTM), Kedah.
CS34311 The Relational Model. cs34312 Why Relational Model? Currently the most widely used Vendors: Oracle, Microsoft, IBM Older models still used IBM’s.
Jennifer Widom Relational Databases The Relational Model.
1 DBS201: More on SQL Lecture 2. 2 Agenda Select command review How to create a table How to insert data into a table.
Lecture # 24 Introduction to SQL Muhammad Emran Database Systems.
1 CS122A: Introduction to Data Management Lecture #4 (E-R  Relational Translation) Instructor: Chen Li.
CENG 351 File Structures and Data Management1 Relational Model Chapter 3.
Standards and Conventions
Creating Database Objects
Introduction To Oracle
CS 3630 Database Design and Implementation
Managing Tables, Data Integrity, Constraints by Adrienne Watt
CS 480: Database Systems Lecture 13 February 13,2013.
Database Models Relational Model
ORACLE SQL Developer & SQLPLUS Statements
STRUCTURED QUERY LANGUAGE
Relational Databases The Relational Model.
Relational Databases The Relational Model.
SQL OVERVIEW DEFINING A SCHEMA
Defining a Database Schema
Session - 6 Sequence - 1 SQL: The Structured Query Language:
Chapter 4 Introduction to MySQL.
CMSC-461 Database Management Systems
Creating Database Objects
CSC 453 Database Technologies
SQL (Structured Query Language)
Presentation transcript:

CIT 613: Relational Database Development using SQL Revision of Tables and Data Types

Tables In relational database systems (DBS) data are represented using tables (relations). A query issued against the DBS also results in a table. A table has the following structure:

Table Structure

Tables A table is uniquely identified by its name and consists of rows that contain the stored information, each row containing exactly one tuple (or record). A table can have one or more columns. A column is made up of a column name and a data type, and it describes an attribute of the tuples.

Tables The structure of a table, also called relation schema, thus is defined by its attributes. The type of information to be stored in a table is defined by the data types of the attributes at table creation time. SQL uses the terms table, row, and column for relation, tuple, and attribute, respectively.

Tables and Data Types A table can have up to 254 columns which may have different or same data types and sets of values (domains), respectively. Possible domains are alphanumeric data (strings), numbers and date formats. Oracle SQL offers the following basic data types:

Data Types char(n): Fixed-length character data (string), n characters long. The maximum size for n is 255 bytes. Note that a string of type char is always padded on right with blanks to full length of n. Example: char(40) (It can be memory consuming).

Data Types varchar2(n): Variable-length character string. The maximum size for n is 2000 Only the bytes used for a string require storage. Example: varchar2(80) number(o, d): Numeric data type for integers and reals. o = overall number of digits, d = number of digits to the right of the decimal point.

Data Types Maximum values: o =38, d= 84 to Examples: number(8), number(5,2). date: Date data type for storing date and time. The default format for a date is: DD- MMM-YY. Examples: 13-OCT-94, 07- JAN-98

Data Types Long: Character data up to a length of 2GB. Only one long column is allowed per table. As long as no constraint restricts the possible values of an attribute, it may have the special value null (for unknown). This value is different from the number 0, and it is also different from the empty string.

Tables Further properties of tables are: the order in which tuples appear in a table is not relevant (unless a query requires an explicit sorting). a table has no duplicate tuples (depending on the query, however, duplicate tuples can appear in the query result).

Database and DB Creation A database schema is a set of relation schemas. The extension of a database schema at database run-time is called a database instance or database. Any database consists of one or more tables. Before creating table/s you have to create first database.

Database and DB Creation So when beginning any database project, the first data management step you take will always be the creation of your database. The SQL syntax for the typical CREATE DATABASE statement looks like this: CREATE DATABASE database_name