sql
sql
Table created.
SQL> create table clients (client_id number primary key,nom varchar2(20) not
null,prenom varchar2(20) not null,email varchar2(20) not null unique,adresse
varchar2(20));
Table created.
SQL> create table commandes (commande_id number primary key,date_commande date not
null,montant_total NUMBER(9,2) ,constraint check_montant check(montant_total
>0) ,client_id number ,foreign key(client_id) references clients(client_id));
Table created.
Table created.
Table created.
Table altered.
SQL> alter table editeurs add constraint uq_client_email unique;
alter table editeurs add constraint uq_client_email unique
*
ERROR at line 1:
ORA-00906: missing left parenthesis
Table altered.
Table altered.
Table altered.
Table altered.
Table altered.
no rows selected
no rows selected
SQL> Disconnected from Oracle Database 11g Express Edition Release 11.2.0.2.0 -
64bit Production
^C
C:\Users\anask.ANAS>connect emsitpg61
'connect' is not recognized as an internal or external command,
operable program or batch file.
C:\Users\anask.ANAS>sqlplus
Connected to:
Oracle Database 11g Express Edition Release 11.2.0.2.0 - 64bit Production
CONSTRAINT_NAME C
------------------------------ -
SYS_C007064 C
SYS_C007065 C
SYS_C007066 C
SYS_C007067 P
SYS_C007068 U
CONSTRAINT_NAME C
------------------------------ -
SYS_C007064 C
SYS_C007065 C
SYS_C007066 C
SYS_C007067 P
SYS_C007068 U
CONSTRAINT_NAME
------------------------------
COLUMN_NAME
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
---------------------------------------------------
SYS_C007064
NOM
SYS_C007065
PRENOM
SYS_C007066
EMAIL
CONSTRAINT_NAME
------------------------------
COLUMN_NAME
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
---------------------------------------------------
SYS_C007067
CLIENT_ID
SYS_C007068
EMAIL
Table altered.
Table altered.
Table altered.
Table altered.
Table altered.
Table altered.
Table altered.
SQL> alter table livres add constraint fk_editeur foreign key (editeur_id)
references editeurs(editeur_id);
Table altered.
SQL> alter table details modify(10,2);
alter table details modify(10,2)
*
ERROR at line 1:
ORA-00904: : invalid identifier
Table altered.
*
ERROR at line 1:
ORA-00920: invalid relational operator
*
ERROR at line 1:
ORA-00920: invalid relational operator
*
ERROR at line 1:
ORA-00904: "LIVRE_ID": invalid identifier
*
ERROR at line 1:
ORA-02264: name already used by an existing constraint
Table created.
TABLE_NAME
------------------------------
LIVRES
CLIENTS
COMMANDES
DETAILS
EDITEURS
AVIS
6 rows selected.
COLUMN_NAME
------------------------------
CLIENT_ID
NOM
PRENOM
EMAIL
Table altered.
Table altered.
Table altered.
SQL> alter table avis add constraint ck_note_range check(note>=1 and note <=5);
Table altered.
Table altered.
Table altered.
Table altered.
Table altered.
Table altered.
SQL>