Tec&Cult
Vous souhaitez réagir à ce message ? Créez un compte en quelques clics ou connectez-vous pour continuer.
Tec&Cult

Technologie et Culture
 
AccueilAccueil  PortailPortail  GalerieGalerie  Dernières imagesDernières images  RechercherRechercher  S'enregistrerS'enregistrer  Connexion  
Sujets similaires
Rechercher
 
 

Résultats par :
 
Rechercher Recherche avancée
Derniers sujets
» Que faire à Paris le week-end du 15 août ?
Oracle SQL Tutorial EmptyJeu 11 Aoû - 11:20 par Admin

» T-shirt Mec de Paname
Oracle SQL Tutorial EmptyMer 3 Aoû - 17:04 par Admin

» dating web site uk dating free parent single
Oracle SQL Tutorial EmptyMer 3 Aoû - 10:56 par Invité

» rsvp dating website seeking bisexual
Oracle SQL Tutorial EmptyLun 1 Aoû - 2:08 par Invité

» dating french woman gay bottom seeking tops
Oracle SQL Tutorial EmptyDim 31 Juil - 21:59 par Invité

» dating philippine woman man seeking wealthy woman
Oracle SQL Tutorial EmptyVen 29 Juil - 12:51 par Invité

» dating lesbian n r cacee cobb dating lachey nick
Oracle SQL Tutorial EmptyVen 29 Juil - 3:17 par Invité

» single dating chat room relationship dating advice
Oracle SQL Tutorial EmptyJeu 28 Juil - 0:21 par Invité

» скачать порно тетя скачать порнофото семейное
Oracle SQL Tutorial EmptyJeu 21 Juil - 14:34 par Invité

Navigation
 Portail
 Index
 Membres
 Profil
 FAQ
 Rechercher
Forum
Partenaires
Forum gratuit


Tchat Blablaland
-17%
Le deal à ne pas rater :
Apple MacBook Air 13” Puce M2 (2022) 256 Go
999 € 1199 €
Voir le deal

Partagez | 
 

 Oracle SQL Tutorial

Voir le sujet précédent Voir le sujet suivant Aller en bas 
AuteurMessage
Admin
Admin


Messages : 156
Date d'inscription : 20/05/2010

Oracle SQL Tutorial _
MessageSujet: Oracle SQL Tutorial   Oracle SQL Tutorial EmptyVen 5 Nov - 12:59

http://toptech.geekaddict.net/
SQL*Plus — schemata — data types — DML & DDL examples — editing commands — using external files — the dual pseudo-table — introduction to transactions — optional exercise — references.
Introduction
During this tutorial you will build on your databases knowledge by learning the fundamentals of Oracle, one of the most widely used database management system in industry.
SQL*Plus

SQL*Plus is Oracle's command-line interpreter. You may launch SQL*Plus by issuing the sqlplus command in UNIX or using the `start' menu in Windows. In the `start' menu, SQL*Plus is listed under programs > oracle > application development > SQL Plus.

You will be prompted for your username and password. If you haven't got an account, you can try to use scott for the username, and tiger for the password. You will learn at a later stage how to change your password. The last piece of information required by SQL*Plus is the name of the database you want to use (called host string).
You are now connected to a shared database, on which you have an account (called a schema ).
Basic SQL

Table 1 outlines the main Oracle SQL data types, together with their MySQL equivalent. Note is the VARCHAR2 type, so called for historical reasons. The NUMBER(p,s) type takes two arguments; precision and scale. The precision of a number its number of significant decimal digits, and its scale is the number of digits after the decimal point.



Table 1: The main SQL data types.
Type description Oracle SQL MySQL SQL
variable-length char. string VARCHAR2(l)1 VARCHAR(l)
fixed-length char. string CHAR(l) CHAR(l)
number NUMBER(p,s)2 NUMERIC(p,s)
currency NUMBER(10,2) NUMERIC(10,2)
date DATE DATE
1 length.
2 precision, scale.

You should now be able to create a few tables and populate them.

CREATE TABLE books
(
title VARCHAR2(60),
author VARCHAR2(60),
isbn NUMBER(10,0)
CONSTRAINT pk_books PRIMARY KEY,
pub_date DATE DEFAULT SYSDATE
)
/

CREATE TABLE book_reviews
(
isbn NUMBER(10,0)
CONSTRAINT fk_books_booksrev REFERENCES books(isbn),
reviewer VARCHAR2(30),
comments VARCHAR2(150)
)
/
Note the use of the SYSDATE function that returns the system's current date in the DEFAULT clause above. The `/' character terminates an SQL statement and submits it to SQL*Plus.
You should be already familiar with the syntax of the primary key and referential integrity constraints. They function in Oracle in a similar fashion as in MySQL. pk_books and fk_books_booksrev are constraint names.
Now check the schema of the tables you have just created using the desc <table_name> command (same command as in MySQL).
Next, we want to insert some data into books and books_reviews:

INSERT INTO books VALUES
(
'The Importance of Being Earnest',
'Oscar Wilde', -- this is a comment
9876543210,
'14-FEB-1895'
)
/
INSERT INTO book_reviews VALUES
(
9876543210,
'Alice',
'Excellent work, humorous and witty.'
)
/
As shown above, the date format expected by Oracle is DD-MMM-YYYY or DD-MMM-YY. The double hyphen sequence `- -' introduces a comment.

Editing Commands

Editing SQL*Plus' buffer.
As you may already have experienced, you cannot recall statements after they have been submitted to SQL*Plus. The ed command allows you to edit the SQL*Plus buffer in the system's default editor. After saving your changes, submit the statement with a `/'. Be aware that only the last statement submitted to SQL*Plus may be edited.
Using command files.
A practical approach to avoid inadvertently losing your SQL work is to use command files.
type in your SQL statements in your favourite editor.
save the file with the .sql extension in your home directory (e.g. myfile.sql)—make sure that you get the correct extension, as some editors will attempt to append a .txt extension.
type in @myfile at the SQL*Plus command prompt to execute your SQL statement(s).
Before starting the next section, you should practise creating and populating some more tables.
Revenir en haut Aller en bas
http://toptech.geekaddict.net
 

Oracle SQL Tutorial

Voir le sujet précédent Voir le sujet suivant Revenir en haut 
Page 1 sur 1

Permission de ce forum:Vous ne pouvez pas répondre aux sujets dans ce forum
Tec&Cult :: Informatique :: Oracle :: Oracle PL SQL-
Sauter vers: