DATABASE SQL= Structure Query Language مبادئ قواعد بيانات

Slides:



Advertisements
Similar presentations
Using DDL Statements to Create and Manage Tables
Advertisements

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)
COMP 5531 Introduction to MySQL. SQL SQL is a standard language for accessing and managing databases. SQL stands for Structured Query Language.
Query Methods (SQL). What is SQL A programming language for databases. SQL (structured Query Language) It allows you add, edit, delete and run queries.
Basic SQL Introduction Presented by: Madhuri Bhogadi.
Copyright  Oracle Corporation, All rights reserved. 10 Creating and Managing Tables.
9 Copyright © Oracle Corporation, All rights reserved. Creating and Managing Tables.
1 Chapter 2: Creating and Modifying Database Tables.
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.
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.
MY SQL Eng: SAHAR. Introduction to SQL What is SQL? When a user wants to get some information from a database file, he can issue a query A query is a.
5.3. Querying a Database SQL -> DDL, DML. SQL Structured Query Language – industry standard supported by all significant relational databases. First SQL.
SQL data definition using Oracle1 SQL Data Definition using Oracle.
10 Copyright © 2009, Oracle. All rights reserved. Using DDL Statements to Create and Manage Tables.
1 Copyright © 2006, Oracle. All rights reserved. Using DDL Statements to Create and Manage Tables.
Copyright © 2004, Oracle. All rights reserved. Using DDL Statements to Create and Manage Tables.
SQL Data Definition Language (DDL) Using Microsoft SQL Server 1SDL Data Definition Language (DDL)
ACTION QUERIES (SQL COMMANDS ) STRUCTURED QUERY LANGUAGE.
DATA MANIPULATION andCONTROL
1 Structured Query Language (SQL). 2 Contents SQL – I SQL – II SQL – III SQL – IV.
Lecture 2: Using DDL Statements to Create and Manage Tables & Indexes
About the Presentations The presentations cover the objectives found in the opening of each chapter. All chapter objectives are listed in the beginning.
1 Creating and Modifying Database Objects. 2 An Oracle database consists of multiple user accounts Each user account owns database objects Tables Views.
10 Creating and Managing Tables Objectives At the end of this lesson, you will be able to: Describe the main database objects Create tables Describe.
10-1 Copyright  Oracle Corporation, All rights reserved. Database Objects ObjectDescription TableBasic unit of storage; composed of rows and columns.
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.
9 Copyright © Oracle Corporation, All rights reserved. Creating and Managing Tables.
Copyright  Oracle Corporation, All rights reserved. 10 Creating and Managing Tables.
SQL: DDL. SQL Statements DDL - data definition language –Defining and modifying data structures (metadata): database, tables, views, etc. DML - data manipulation.
SQL Basics. What is SQL? SQL stands for Structured Query Language. SQL lets you access and manipulate databases.
Tables and Constraints Oracle PL/SQL. Datatypes The SQL Data Definition Language Commands (or DDL) enable us to create, modify and remove database data.
CREATE TABLE CREATE TABLE statement is used for creating relations Each column is described with three parts: column name, data type, and optional constraints.
Prince Sultan University Dept. of Computer & Information Sciences CS 340 Introduction to Database Systems.
9 Copyright © 2004, Oracle. All rights reserved. Using DDL Statements to Create and Manage Schema Objects.
SQL John Nowobilski. What is SQL? Structured Query Language Manages Data in Database Management Systems based on the Relational Model Developed in 1970s.
Kansas State University Department of Computing and Information Sciences CIS 560: Database System Concepts Thursday, September 13, 2000 “Structured Query.
1 DBS201: More on SQL Lecture 3. 2 Agenda How to use SQL to update table definitions How to update data in a table How to join tables together.
9 Copyright © Oracle Corporation, All rights reserved. Creating and Managing Tables.
1 Chapter 2: Creating and Modifying Database Objects.
Sql DDL queries CS 260 Database Systems.
Copyright © 2004, Oracle. All rights reserved. Lecture 2: Using DDL Statements to Create and Manage Tables & Indexes ORACLE.
©Silberschatz, Korth and Sudarshan1 Structured Query Language (SQL) Data Definition Language Domains Integrity Constraints.
Altering Tables and Constraints Database Systems Objectives Add and modify columns. Add, enable, disable, or remove constraints. Drop a table. Remove.
DDL and Views. Database Objects Logically represents subsets of data from one or more tables View Generates numeric valuesSequence Basic unit of storage;
Creating and Managing Tables 14. ObjectivesObjectives After completing this lesson, you should be able to do the following: After completing this lesson,
Relational Database Management System(RDBMS) Structured Query Language(SQL)
Oracle & SQL. Oracle Data Types Character Data Types: Char(2) Varchar (20) Clob: large character string as long as 4GB Bolb and bfile: large amount of.
Chapter 3 Table Creation and Management Oracle 10g: SQL.
Understand Data Definition Language (DDL) Database Administration Fundamentals LESSON 1.4.
CS SQL.
SQL: Schema Definition and Constraints Chapter 6 week 6
DATABASE MANAGEMENT SYSTEM
Structured Query Language (Data definition Language)
Workbench Data Definition Language (DDL)
لغة قواعد البيانات STRUCTURED QUERY LANGUAGE SQL))
SQL OVERVIEW DEFINING A SCHEMA
SQL data definition using Oracle
DATABASE SQL= Structure Query Language مبادئ قواعد بيانات
Session - 6 Sequence - 1 SQL: The Structured Query Language:
Data Definition Language
Data Definition Language
Oracle : SQL.
Instructor: Samia arshad
Instructor: SAMIA ARSHAD
Structured Query Language Path from Unorganized to Organized….
Object – relational database
Database SQL.
SQL (Structured Query Language)
Presentation transcript:

DATABASE SQL= Structure Query Language مبادئ قواعد بيانات

الفصل العاشر انشاء الجدول انواع البيانات التعديل في الجدول باستخدام Alter Table إلغاء الجدول Drop إعادة تسمية الجدول Rename

اولاً :- لغة تعريف البيانات DATA DEFINITION LANGUGE (DDL) :- إنشاء الجدول TABLE Creation : - Create Table Table-name ( column-name (Data-type) , column-name (Data-type ) , column-name (Data-type ) , column-name (Data-type ) ); ( اسم الجدول ) جدول أنشئ العمود الأول نوع البيانات العمود الثاني نوع البيانات العمود الثالث نوع البيانات العمود الرابع نوع البيانات

مثال : Create Table Employees ( ID Number (5) , NAME Varchar2 (30) , TEL Number (15) ) ; Employees ID NAME TEL <=شكل الجدول الذي أنشأناه معاني الكلمات بالعربي : Employees الموظفين = ID = رقم NAME = الاسم TEL =رقم التلفون

أنواع البيانات DataTypes نوع البيانات الوصف Varchar(الحجم) تستخدم مع البيانات الحرفية المتغيرة الطول Char(الحجم) تستخدم مع البيانات الحرفية الثابتة الطول Number(p,s) تستخدم مع البيانات الرقمية و يمثل P الجزء الصحيح قبل علامه العشرية يمثل S الجزء العشري بعد العلامة العشرية Date تستخدم مع بيانات التاريخ Long تستخدم لتمثيل البيانات الكبيرة الحجم التي تصل الى 2GB CLoB- BLOB تستخدم لتمثل البيانات الكبيرة مثل الصور والرسومات تصل الى 4GB Bfile تستخدم لتخزين الملفات الكبيرة الخارجية التي صل الى اكثر من 4GB

الشروط الواجب توفرها عند اختيار اسم الجدول او اسماء الاعمده: يجب ان يبدا اسم الجدول او اسم العمود بحرف يجب ان لا يزيد طول الاسم عن 30 حرفا من الممكن ان يتكون من حروف كبيرة و صغيرة وارقام ورموز خاصه مثل (@,#,% ............ ) يجب ان لا يتكرر اسم الجدول اكثر من مره داخل قاعده البيانات الواحدة . يجب ان لا يتكرر اسم العمود اكثر من مره داخل الجدول الواحد يجب ان لا يتكرر من الاسماء المحجوزة لأوراكل مثل (FORM- SELECT……. يفضل ان يكون اسم الجدول له معنى بحيث يُعبر عن نوع البيانات الجدول

التعديل في الجدول باستخدام Alter Table أوجه التعديل في الجدول ADD تستخدم لأضافه أعمدة جديدة الى الجدول MODIFY تستخدم للتعديل في نوع البيانات للجدول DROP تستخدم لإلغاء عمود معين من الجدول

لإضافة عمود جديد : لتعديل وصف عمود : لحذف عمود : عدل Alter table Table-Name Add (filed name data-type); لتعديل وصف عمود : Alter table table- name modify (filed -name data-type); لحذف عمود : Alter table table- name Drop ( Filed-name data-type ); اسم الجدول الجدول عدل أضف العمود ( الحقل الأول ) نوع البيانات عدل الغاء

مثال : لإضافة عمود : SQL> Alter table Employees Add ( Salary Number (5 , 2) ); اسم الجدول الجدول عدل إلى الجدول : salary اضاف عمود الراتب Employees ID NAME TEL Salary Salary = الراتب

مثال : للتعديل على العمود : SQL> Alter table Employees Modify ( NAME varchar2 (35) ); تم تتغير بيانات عمود الاسم من 30 إلى 35 خانة . Employees ID NAME TEL Salary

مثال : لحذف عمود : SQL> Alter table Employees Drop ( Salary Number (5 , 2) ); من الجدول : salary سيتم حذف عمود الراتب Employees ID NAME TEL

إلغاء الجدول باستخدام Drop عملية إلغاء الجدول هي عبارة عن الغاء الجدول تماما من قاعدة البيانات وحذف كل بيانات وكل القيود المتعلقة به , وبتأكيد لا يمكن استعادته مره أخرى.. لحذف جدول : SQL> Drop table Employees ; Table dropped

تغير اسم الجدول الى اسم آخر Rename لتغير اسم الجدول : لحذف جدول : SQL> RENAME table Employees TO customer; Table rename