SQL (Structured Query Language)

Slides:



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

SQL Rohit Khokher.
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.
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)
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.
30-Jun-15 SQL A Brief Introduction. SQL SQL is Structured Query Language Some people pronounce SQL as “sequel” Other people insist that only “ess-cue-ell”
Structured Query Language. Brief History Developed in early 1970 for relational data model: –Structured English Query Language (SEQUEL) –Implemented with.
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.
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 SQL  SQL or sequel  It is a standardised language with thousands of pages in the standard  It can be in database system through GUI,
Oracle Data Definition Language (DDL)
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.
Structured Query Language. Brief History Developed in early 1970 for relational data model: –Structured English Query Language (SEQUEL) –Implemented with.
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.
Chapter 8 Part 1 SQL-99 Schema Definition, Constraints, Queries, and Views.
Chapter 7 SQL HUANG XUEHUA. SQL SQL server2005 introduction Install components  management studio.
CSC 2720 Building Web Applications Database and SQL.
Oracle Data Definition Language (DDL) Dr. Bernard Chen Ph.D. University of Central Arkansas Fall 2008.
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.
Chapter 5: Part 1: DDL STRUCTURED QUERY LANGUAGE (SQL)
SQL FUNDAMENTALS SQL ( Structured Query Language )
1 Structured Query Language (SQL). 2 Contents SQL – I SQL – II SQL – III SQL – IV.
SQL Basics. 5/27/2016Chapter 32 of 19 Naming SQL commands are NOT case sensitive SQL commands are NOT case sensitive But user identifier names ARE case.
SQL: DDL. SQL Statements DDL - data definition language –Defining and modifying data structures (metadata): database, tables, views, etc. DML - data manipulation.
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.
SQL Basics. What is SQL? SQL stands for Structured Query Language. SQL lets you access and manipulate databases.
Advanced Database CS-426 Week 1 - Introduction. Database Management System DBMS contains information about a particular enterprise Collection of interrelated.
Tables and Constraints Oracle PL/SQL. Datatypes The SQL Data Definition Language Commands (or DDL) enable us to create, modify and remove database data.
Prince Sultan University Dept. of Computer & Information Sciences CS 340 Introduction to Database Systems.
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 DDL queries CS 260 Database Systems.
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.
ITS232 Introduction To Database Management Systems Siti Nurbaya Ismail Faculty of Computer Science & Mathematics, Universiti Teknologi MARA (UiTM), Kedah.
1 CS 430 Database Theory Winter 2005 Lecture 10: Introduction to SQL.
Relational Database Management System(RDBMS) 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.
Structured Query Language (SQL) DDL
CPSC-310 Database Systems
CS 3630 Database Design and Implementation
Managing Tables, Data Integrity, Constraints by Adrienne Watt
Insert, Update and the rest…
CS 480: Database Systems Lecture 13 February 13,2013.
DATABASE SQL= Structure Query Language مبادئ قواعد بيانات
Database Models Relational Model
ORACLE SQL Developer & SQLPLUS Statements
DATABASE MANAGEMENT SYSTEM
STRUCTURED QUERY LANGUAGE
SQL OVERVIEW DEFINING A SCHEMA
DATABASE SQL= Structure Query Language مبادئ قواعد بيانات
Defining a Database Schema
Oracle Data Definition Language (DDL)
SQL-1 Week 8-9.
Session - 6 Sequence - 1 SQL: The Structured Query Language:
Instructor: Samia arshad
Session - 6 Sequence - 1 SQL: The Structured Query Language:
Instructor: SAMIA ARSHAD
Structured Query Language Path from Unorganized to Organized….
Presentation transcript:

SQL (Structured Query Language) SQL (Structured Query Language) is a standard language for accessing and manipulating databases.

SQL is categorised into different categories based on the purpose. i) Data Definition Language (DDL) statement ii) Data Manipulation Language (DML) statement iii) Transaction Control Statement iv) Session Control Statement v) System Control Statement vi) Embedded SQL Statement

In SQL there are three main data types: Character, Number, and Date types. Character data type Character data types stores alphanumeric data Character data types are; i)char ii) varchar iii) varchar2

char varchar Format: char(n) Fixed-length character string having maximum length ‘n’. has fixed length, right padded with spaces. varchar Format: varchar (n) Variable-length character string having maximum length ‘n’. has fixed length, right padded with NULL

is used to store variable length character strings Varchar2 Format: varchar2 (n) is used to store variable length character strings has variable length.

Number data type Numeric data types are mainly used to store number with or without fraction part. The numeric data types are: NUMBER DECIMAL NUMERIC INT FLOAT

NUMBER: The Number data type is used to store integers negative, positive, floating number of up to 38 digits of precision. Format: NUMBER (p, s) 'p' is the total number of significant decimal digits 's' is the number of digits from the decimal point

decimal and numeric Format DECIMAL[ (p[ , s] )] and NUMERIC[ (p[ , s] )] Square brackets ([ ]) are option. 'p' is the total number of significant decimal digits 's' is the number of digits from the decimal point

int : This used to store integer number (without any fraction part). float: This data type is used to store number with fraction part(real numbers). ****************

DDL CREATE TABLE command is used to create table structure. In SQL, we have the following constraints: NOT NULL - To check a column cannot store NULL value. PRIMARY KEY - To check that a column have an unique identity which helps to find a particular record in a table.

DDL 1)CREATE command ->used to create a table ID NAME SALARY 1 ARUN 6000 2 VARUN 8000 Write the command to create a table student with attribute id,name,salary. create table student(id int, name char(20),salary int );

DDL 1)CREATE command ->used to create a table Column name Data type constraints Adno Numeric(3) Primary key Name Varchar (20) Not null Class Numeric(2) Section Char(1) Fees Numeric(10,2) CREATE TABLE student (Adno Numeric (3) Primary Key, Name varchar (20) not null, Class Numeric (2), Section char (1), Fees numeric (10, 2));

DDL 2)DROP command ->used to delete a table Write the command to delete a table student. drop table student;

DDL 3) ALTER Command ->Used to add attribute, modify attribute, delete attribute 1) Write the command to add a new attribute ‘address’ with data type varchar(20). ALTER TABLE STUDENT ADD ADDRESS VARCHAR(20); 2)Write the command to change the data type of the attribute ‘address’ to varchar(30). ALTER TABLE STUDENT MODIFY ADDRESS VARCHAR(30); 3)Write the command to delete the attribute ‘address’. ALTER TABLE STUDENT DROP ADDRESS ;