`
雨过天晴0521
  • 浏览: 154721 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

about Teradata SQL

 
阅读更多
http://www.razorsql.com/docs/teradata_alter_table.html

Rename table:
rename table Samples.p to Samples.ccqa08_p


Add Column:
ALTER TABLE Samples.address ADD NewCol CHAR(25)
ALTER TABLE Samples.address ADD NewCol CHAR(25) DEFAULT '22' NOT NULL


Add Primary Key:
ALTER TABLE RETAIL.EMPLOYEE ADD PRIMARY KEY (EmpNo)


Add Foreign Key:
ALTER TABLE Samples.address
ADD FOREIGN KEY (DeptNo) 
REFERENCES address.CLIENT(C_CUSTKEY)


Modify Primary Index:
ALTER TABLE Samples.address MODIFY PRIMARY INDEX (address_id)


Cleanup Data:
Delete from Samples.address


Drop Table:
DROP TABLE retail.employee


Drop View:
DROP VIEW retail.employee_view


Drop Column:
ALTER TABLE Samples.address DROP COLUMN cachekey


Drop Constraint:
ALTER TABLE Samples.address DROP CONSTRAINT address_id


Create View:
CREATE VIEW retail.test_view AS select id from customer


Create Table:
CREATE TABLE retail.test_table
(col1 INTEGER NOT NULL,
col2 CHAR(25),
col3 VARCHAR(25) NOT NULL,
col4 DATE,
PRIMARY KEY (col1))


Note for Create Table:
Column Name
Column Type (for example, Integer, Char, Varchar, etc.)
Length or Precision
Scale (for decimal columns)
Nullability (whether or not the column accepts null)
Primary Key (whether or not the column is a primary key)
Unique (whether to add a unique constraint to the column)
Default Value (the default value that should be inserted when a null is attempted to be inserted into the column)

You can get more docs of teradata database from http://www.teradataforum.com/ncr_pdf.htm
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics