SlideShare a Scribd company logo
1 of 38
Creating and Managing Tables
Objectives ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Database Objects Object Description Table Basic unit of storage; composed of rows  and columns View  Logically represents subsets of data from  one or more tables Sequence  Numeric value generator Index Improves the performance of some queries Synonym  Gives alternative names to objects
Naming Rules ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
The  CREATE TABLE  Statement ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],CREATE TABLE [ schema .] table   ( column   datatype  [DEFAULT  expr ][, ...]);
Referencing Another User’s Tables ,[object Object],[object Object]
The  DEFAULT  Option ,[object Object],[object Object],[object Object],[object Object],... hire_date DATE DEFAULT SYSDATE, ...
[object Object],[object Object],Creating Tables DESCRIBE dept CREATE TABLE dept (deptno  NUMBER(2), dname  VARCHAR2(14), loc  VARCHAR2(13)); Table created.
Tables in the Oracle Database ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Querying the Data Dictionary SELECT table_name  FROM   user_tables ; SELECT *  FROM   user_catalog ; ,[object Object],[object Object],SELECT DISTINCT object_type  FROM    user_objects ; ,[object Object]
Data Types Data Type Description VARCHAR2( size ) Variable-length character data CHAR( size )  Fixed-length character data NUMBER( p , s)   Variable-length numeric data DATE  Date and time values LONG  Variable-length character data  up to 2 gigabytes CLOB Character data up to 4 gigabytes RAW and LONG RAW   Raw binary data BLOB Binary data up to 4 gigabytes BFILE Binary data stored in an external  file; up to 4 gigabytes ROWID A 64 base number system representing  the unique address of a row in its table.
 
DateTime Data Types ,[object Object],[object Object],[object Object],[object Object],Data Type   Description TIMESTAMP Date with fractional seconds INTERVAL YEAR TO MONTH Stored as an interval of years  and months INTERVAL DAY TO SECOND Stored as an interval of days to hours minutes and seconds
DateTime Data Types ,[object Object],[object Object],[object Object],TIMESTAMP[(fractional_seconds_precision)]
TIMESTAMP   WITH   TIME   ZONE  Data Type ,[object Object],[object Object],TIMESTAMP[(fractional_seconds_precision)] WITH TIME ZONE
TIMESTAMP   WITH   LOCAL   TIME  Data Type ,[object Object],[object Object],[object Object],[object Object],TIMESTAMP[(fractional_seconds_precision)] WITH LOCAL TIME ZONE
INTERVAL   YEAR   TO   MONTH  Data Type ,[object Object],INTERVAL YEAR [(year_precision)] TO MONTH INTERVAL '123-2' YEAR(3) TO MONTH Indicates an interval of 123 years, 2 months. INTERVAL '123' YEAR(3) Indicates an interval of 123 years 0 months. INTERVAL '300' MONTH(3) Indicates an interval of 300 months. INTERVAL '123' YEAR Returns an error, because the default precision is 2,  and '123' has 3 digits.
INTERVAL   DAY   TO   SECOND  Data Type ,[object Object],INTERVAL DAY [(day_precision)]  TO SECOND [(fractional_seconds_precision)] INTERVAL '4 5:12:10.222' DAY TO SECOND(3) Indicates 4 days, 5 hours, 12 minutes, 10 seconds,  and 222 thousandths of a second.INTERVAL '123' YEAR(3). INTERVAL '7' DAY Indicates 7 days. INTERVAL '180' DAY(3)  Indicates 180 days.
INTERVAL   DAY   TO   SECOND  Data Type ,[object Object],INTERVAL '4 5:12:10.222' DAY TO SECOND(3) Indicates 4 days, 5 hours, 12 minutes, 10 seconds,  and 222 thousandths of a second. INTERVAL '4 5:12' DAY TO MINUTE Indicates 4 days, 5 hours and 12 minutes. INTERVAL '400 5' DAY(3) TO HOUR Indicates 400 days 5 hours. INTERVAL '11:12:10.2222222' HOUR TO SECOND(7) indicates 11 hours, 12 minutes, and 10.2222222 seconds.
Creating a Table  by Using a Subquery Syntax ,[object Object],[object Object],[object Object],CREATE TABLE  table   [( column ,  column ...)] AS  subquery;
Creating a Table by Using a Subquery DESCRIBE dept80 CREATE TABLE  dept80 AS    SELECT  employee_id, last_name,  salary*12 ANNSAL,  hire_date   FROM  employees   WHERE  department_id = 80; Table created.
The  ALTER   TABLE  Statement ,[object Object],[object Object],[object Object],[object Object],[object Object]
The  ALTER   TABLE  Statement ,[object Object],[object Object],ALTER TABLE  table ADD   ( column datatype  [DEFAULT  expr ]   [,  column datatype ]...); ALTER TABLE  table MODIFY   ( column datatype  [DEFAULT  expr ]   [,  column datatype ]...); ALTER TABLE  table DROP   ( column );
Adding a Column DEPT80 “ Add a new column to the  DEPT80  table.” DEPT80 New column
Adding a Column ,[object Object],[object Object],ALTER TABLE dept80 ADD   (job_id VARCHAR2(9)); Table altered.
Modifying a Column ,[object Object],[object Object],ALTER TABLE dept80 MODIFY (last_name VARCHAR2(30)); Table altered.
Dropping a Column ,[object Object],[object Object],ALTER TABLE  dept80 DROP COLUMN  job_id;  Table altered.
The  SET   UNUSED  Option ,[object Object],[object Object],ALTER TABLE   table SET  UNUSED ( column ); ALTER TABLE  table SET  UNUSED COLUMN  column; OR ALTER TABLE  table DROP  UNUSED COLUMNS;
Dropping a Table ,[object Object],[object Object],[object Object],[object Object],DROP TABLE dept80; Table dropped.
Changing the Name of an Object ,[object Object],[object Object],RENAME dept TO detail_dept; Table renamed.
Truncating a Table ,[object Object],[object Object],[object Object],[object Object],[object Object],TRUNCATE TABLE detail_dept; Table truncated.
Adding Comments to a Table ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],COMMENT ON TABLE employees IS 'Employee Information'; Comment created.
Summary Statement  Description CREATE TABLE   Creates a table  ALTER TABLE   Modifies table structures  DROP TABLE   Removes the rows and table structure RENAME   Changes the name of a table, view,  sequence, or synonym TRUNCATE  Removes all rows from a table and  releases the storage space COMMENT  Adds comments to a table or view In this lesson, you should have learned how to use DDL statements to create, alter, drop, and rename tables.
Practice 9 Overview ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
 
 
 
 

More Related Content

What's hot (20)

SQL
SQLSQL
SQL
 
ADBMS Unit-II c
ADBMS Unit-II cADBMS Unit-II c
ADBMS Unit-II c
 
Les10
Les10Les10
Les10
 
Appendix A Tables
Appendix A   TablesAppendix A   Tables
Appendix A Tables
 
DML Commands
DML CommandsDML Commands
DML Commands
 
Dbms record
Dbms recordDbms record
Dbms record
 
Intro to tsql unit 7
Intro to tsql   unit 7Intro to tsql   unit 7
Intro to tsql unit 7
 
DDL,DML,SQL Functions and Joins
DDL,DML,SQL Functions and JoinsDDL,DML,SQL Functions and Joins
DDL,DML,SQL Functions and Joins
 
Sql commands
Sql commandsSql commands
Sql commands
 
Sql basics and DDL statements
Sql basics and DDL statementsSql basics and DDL statements
Sql basics and DDL statements
 
Database Management - Lecture 2 - SQL select, insert, update and delete
Database Management - Lecture 2 - SQL select, insert, update and deleteDatabase Management - Lecture 2 - SQL select, insert, update and delete
Database Management - Lecture 2 - SQL select, insert, update and delete
 
Exploring collections with example
Exploring collections with exampleExploring collections with example
Exploring collections with example
 
Lab
LabLab
Lab
 
Varraysandnestedtables
VarraysandnestedtablesVarraysandnestedtables
Varraysandnestedtables
 
A must Sql notes for beginners
A must Sql notes for beginnersA must Sql notes for beginners
A must Sql notes for beginners
 
Stata Cheat Sheets (all)
Stata Cheat Sheets (all)Stata Cheat Sheets (all)
Stata Cheat Sheets (all)
 
introdution to SQL and SQL functions
introdution to SQL and SQL functionsintrodution to SQL and SQL functions
introdution to SQL and SQL functions
 
Les10 Creating And Managing Tables
Les10 Creating And Managing TablesLes10 Creating And Managing Tables
Les10 Creating And Managing Tables
 
R gráfico
R gráficoR gráfico
R gráfico
 
MySQL Essential Training
MySQL Essential TrainingMySQL Essential Training
MySQL Essential Training
 

Similar to Les09

e computer notes - Creating and managing tables
e computer notes -  Creating and managing tablese computer notes -  Creating and managing tables
e computer notes - Creating and managing tablesecomputernotes
 
Les09 (using ddl statements to create and manage tables)
Les09 (using ddl statements to create and manage tables)Les09 (using ddl statements to create and manage tables)
Les09 (using ddl statements to create and manage tables)Achmad Solichin
 
Creating and Managing Tables -Oracle Data base
Creating and Managing Tables -Oracle Data base Creating and Managing Tables -Oracle Data base
Creating and Managing Tables -Oracle Data base Salman Memon
 
Unit-1 SQL fundamentals.docx SQL commands used to create table, insert values...
Unit-1 SQL fundamentals.docx SQL commands used to create table, insert values...Unit-1 SQL fundamentals.docx SQL commands used to create table, insert values...
Unit-1 SQL fundamentals.docx SQL commands used to create table, insert values...SakkaravarthiS1
 
DDL. data defination language for creating database
DDL. data defination language for creating databaseDDL. data defination language for creating database
DDL. data defination language for creating databaseSHAKIR325211
 
SQL - DML and DDL Commands
SQL - DML and DDL CommandsSQL - DML and DDL Commands
SQL - DML and DDL CommandsShrija Madhu
 
MariaDB Server 10.3 - Temporale Daten und neues zur DB-Kompatibilität
MariaDB Server 10.3 - Temporale Daten und neues zur DB-KompatibilitätMariaDB Server 10.3 - Temporale Daten und neues zur DB-Kompatibilität
MariaDB Server 10.3 - Temporale Daten und neues zur DB-KompatibilitätMariaDB plc
 
SQL WORKSHOP::Lecture 10
SQL WORKSHOP::Lecture 10SQL WORKSHOP::Lecture 10
SQL WORKSHOP::Lecture 10Umair Amjad
 
Creating database using sql commands
Creating database using sql commandsCreating database using sql commands
Creating database using sql commandsBelle Wx
 
What's New in MariaDB Server 10.3
What's New in MariaDB Server 10.3What's New in MariaDB Server 10.3
What's New in MariaDB Server 10.3MariaDB plc
 
Introduction to Oracle Database.pptx
Introduction to Oracle Database.pptxIntroduction to Oracle Database.pptx
Introduction to Oracle Database.pptxSiddhantBhardwaj26
 

Similar to Les09 (20)

e computer notes - Creating and managing tables
e computer notes -  Creating and managing tablese computer notes -  Creating and managing tables
e computer notes - Creating and managing tables
 
Les09
Les09Les09
Les09
 
Les09 (using ddl statements to create and manage tables)
Les09 (using ddl statements to create and manage tables)Les09 (using ddl statements to create and manage tables)
Les09 (using ddl statements to create and manage tables)
 
Less08 Schema
Less08 SchemaLess08 Schema
Less08 Schema
 
Creating and Managing Tables -Oracle Data base
Creating and Managing Tables -Oracle Data base Creating and Managing Tables -Oracle Data base
Creating and Managing Tables -Oracle Data base
 
Les09.ppt
Les09.pptLes09.ppt
Les09.ppt
 
Unit-1 SQL fundamentals.docx SQL commands used to create table, insert values...
Unit-1 SQL fundamentals.docx SQL commands used to create table, insert values...Unit-1 SQL fundamentals.docx SQL commands used to create table, insert values...
Unit-1 SQL fundamentals.docx SQL commands used to create table, insert values...
 
Chapter 4 Structured Query Language
Chapter 4 Structured Query LanguageChapter 4 Structured Query Language
Chapter 4 Structured Query Language
 
Module 3
Module 3Module 3
Module 3
 
DDL. data defination language for creating database
DDL. data defination language for creating databaseDDL. data defination language for creating database
DDL. data defination language for creating database
 
Database
Database Database
Database
 
Oraclesql
OraclesqlOraclesql
Oraclesql
 
Dbms sql-final
Dbms  sql-finalDbms  sql-final
Dbms sql-final
 
SQL - DML and DDL Commands
SQL - DML and DDL CommandsSQL - DML and DDL Commands
SQL - DML and DDL Commands
 
MariaDB Server 10.3 - Temporale Daten und neues zur DB-Kompatibilität
MariaDB Server 10.3 - Temporale Daten und neues zur DB-KompatibilitätMariaDB Server 10.3 - Temporale Daten und neues zur DB-Kompatibilität
MariaDB Server 10.3 - Temporale Daten und neues zur DB-Kompatibilität
 
SQL WORKSHOP::Lecture 10
SQL WORKSHOP::Lecture 10SQL WORKSHOP::Lecture 10
SQL WORKSHOP::Lecture 10
 
unit 1 ppt.pptx
unit 1 ppt.pptxunit 1 ppt.pptx
unit 1 ppt.pptx
 
Creating database using sql commands
Creating database using sql commandsCreating database using sql commands
Creating database using sql commands
 
What's New in MariaDB Server 10.3
What's New in MariaDB Server 10.3What's New in MariaDB Server 10.3
What's New in MariaDB Server 10.3
 
Introduction to Oracle Database.pptx
Introduction to Oracle Database.pptxIntroduction to Oracle Database.pptx
Introduction to Oracle Database.pptx
 

More from Vijay Kumar (18)

Les20
Les20Les20
Les20
 
Les19
Les19Les19
Les19
 
Les18
Les18Les18
Les18
 
Les17
Les17Les17
Les17
 
Les15
Les15Les15
Les15
 
Les16
Les16Les16
Les16
 
Les14
Les14Les14
Les14
 
Les13
Les13Les13
Les13
 
Les12
Les12Les12
Les12
 
Les10
Les10Les10
Les10
 
Les11
Les11Les11
Les11
 
Les07
Les07Les07
Les07
 
Les08
Les08Les08
Les08
 
Les06
Les06Les06
Les06
 
Les05
Les05Les05
Les05
 
Les04
Les04Les04
Les04
 
Les03
Les03Les03
Les03
 
Les02
Les02Les02
Les02
 

Recently uploaded

My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
Bluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdfBluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdfngoud9212
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentationphoebematthew05
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Science&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfScience&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfjimielynbastida
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024BookNet Canada
 
Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Neo4j
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 

Recently uploaded (20)

My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
Bluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdfBluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdf
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort ServiceHot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentation
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
Science&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfScience&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdf
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
 
Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 

Les09

  • 2.
  • 3. Database Objects Object Description Table Basic unit of storage; composed of rows and columns View Logically represents subsets of data from one or more tables Sequence Numeric value generator Index Improves the performance of some queries Synonym Gives alternative names to objects
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11. Data Types Data Type Description VARCHAR2( size ) Variable-length character data CHAR( size ) Fixed-length character data NUMBER( p , s) Variable-length numeric data DATE Date and time values LONG Variable-length character data up to 2 gigabytes CLOB Character data up to 4 gigabytes RAW and LONG RAW Raw binary data BLOB Binary data up to 4 gigabytes BFILE Binary data stored in an external file; up to 4 gigabytes ROWID A 64 base number system representing the unique address of a row in its table.
  • 12.  
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21. Creating a Table by Using a Subquery DESCRIBE dept80 CREATE TABLE dept80 AS SELECT employee_id, last_name, salary*12 ANNSAL, hire_date FROM employees WHERE department_id = 80; Table created.
  • 22.
  • 23.
  • 24. Adding a Column DEPT80 “ Add a new column to the DEPT80 table.” DEPT80 New column
  • 25.
  • 26.
  • 27.
  • 28.
  • 29.
  • 30.
  • 31.
  • 32.
  • 33. Summary Statement Description CREATE TABLE Creates a table ALTER TABLE Modifies table structures DROP TABLE Removes the rows and table structure RENAME Changes the name of a table, view, sequence, or synonym TRUNCATE Removes all rows from a table and releases the storage space COMMENT Adds comments to a table or view In this lesson, you should have learned how to use DDL statements to create, alter, drop, and rename tables.
  • 34.
  • 35.  
  • 36.  
  • 37.  
  • 38.  

Editor's Notes

  1. Schedule: Timing Topic 30 minutes Lecture 20 minutes Practice 50 minutes Total