Oracle PL/SQL Tutorial/Table/Drop Column

Материал из SQL эксперт

Перейти к: навигация, поиск

Drop a just added column

SQL>
SQL>
SQL> CREATE TABLE registrations
  2  ( attendee    NUMBER(4)
  3  , course      VARCHAR2(6)
  4  , begindate   DATE
  5  , evaluation  NUMBER(1)) ;
TABLE created.
SQL>
SQL>
SQL> INSERT INTO registrations VALUES (1, "SQL",date "1999-04-12",4   );
1 row created.
SQL> INSERT INTO registrations VALUES (2, "SQL",date "1999-12-13",NULL);
1 row created.
SQL> INSERT INTO registrations VALUES (3, "SQL",date "1999-12-13",NULL);
1 row created.
SQL> INSERT INTO registrations VALUES (4, "OAU",date "1999-08-10",4   );
1 row created.
SQL> INSERT INTO registrations VALUES (5, "OAU",date "2000-09-27",5   );
1 row created.
SQL> INSERT INTO registrations VALUES (6, "JAV",date "1999-12-13",2   );
1 row created.
SQL> INSERT INTO registrations VALUES (7, "JAV",date "2000-02-01",4   );
1 row created.
SQL> INSERT INTO registrations VALUES (8, "JAV",date "2000-02-01",5   );
1 row created.
SQL> INSERT INTO registrations VALUES (9, "XML",date "2000-02-03",4   );
1 row created.
SQL> INSERT INTO registrations VALUES (10,"XML",date "2000-02-03",5   );
1 row created.
SQL> INSERT INTO registrations VALUES (1, "PLS",date "2000-09-11",NULL);
1 row created.
SQL> INSERT INTO registrations VALUES (2, "PLS",date "2000-09-11",NULL);
1 row created.
SQL> INSERT INTO registrations VALUES (3, "PLS",date "2000-09-11",NULL);
1 row created.
SQL>
SQL>
SQL> ALTER TABLE registrations
  2  ADD  (entered_by number(4) DEFAULT 7839 NOT NULL);
TABLE altered.
SQL>
SQL> ALTER TABLE registrations
  2  DROP  COLUMN entered_by;
TABLE altered.
SQL>
SQL> DROP TABLE registrations;
TABLE dropped.
SQL>