Team Fly |
The following SQL statements are examples of DDL create and drop statements in action:
SQL> create table b 2 (colb char(1)); SQL> drop table b; Table dropped. SQL> create table state 2 (state_cd char(2) not null, 3 state_name varchar2(30)); Table created.
After you have created your table, you should confirm that it was created as you expected. To display a description of a table, the describe command is used. Experience suggests that you will find it very useful to be able to describe tables within the database after you create or any time you need to know the exact nature of the table. Let's take a closer look at the state table that we created in the previous example:
SQL> desc state; Name Null? Type ----------------------------------------- -------- ------------------- STATE_CD NOT NULL CHAR(2) STATE_NAME VARCHAR2(30)
DML is any SQL statement that begins with select, insert, update, or delete. The remainder of this chapter will deal primarily with DML. Every DML SQL statement consists of a few basic components. The following three items form the basic foundation of most DML statements:
Each DML statement begins with either a select, insert, update or delete command:
select is used when you want to retrieve data from an Oracle database. It is the most common SQL statement you will see.
insert is used when you want to add rows into an Oracle table.
update commands are used to change one or more records in a table.
delete commands are issued when you want to remove one or more records from a table.
Team Fly |