2. Oracle – SQL

09Mar11

開新的table
create table table_name ( Attribute_name type, ... , primary key ( attribute_name), foreign key ( attribute_name ) references table_name );

刪除一個table
drop table table_name;

在現有的table加一個Column

alter table table_name add Attribute Type;

在現有的table刪除一個Column
alter table table_name drop Attribute;

選取資料

select Attribute from table_name;

用Where clause的Select statement
select a.Attribute, b.Attribute2 from table_name as a, table_name2 as b where a.sth = b.sth;

增加在Command Line 顯示的闊度到250個字元
set lin 250



No Responses Yet to “2. Oracle – SQL”

  1. Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s


Follow

Get every new post delivered to your Inbox.