-- File: NetezzaCheatSheet.sql docs at the end
-- how-to create a database
CREATE DATABASE DatabaseName;
-- how-to rename a database
ALTER DATABASE OldDatabaseName RENAME TO NewDatabaseName ;
-- how-to create a synomim
CREATE SYNONYM synonym_name FOR DatabaseName.SchemaName.TableName ;
-- how-to create a table
CREATE TABLE ExampleTableName (
ColVarchar varchar(80) -- a column of the type Varchar
, ColInt int -- a column of int type
, ColDate date -- a column of the type date
);
-- how-to insert data from non-current db to current db table
INSERT INTO TableName SELECT * FROM DatabaseName..TableName;
-- how-to drop a table
DROP TABLE DatabaseName..TableName ;
-- how-to change the ownership of a table
ALTER TABLE TableName OWNER TO NewOwner ;
-- how-to perform a simple select
SELECT * FROM TableName
WHERE
AND 1=1
AND WhereColumnName = 'WhereCondition'
AND GreaterThanColumnName > 0.0
ORDER BY WhereColumnName
;
-- how-to delete from table
DELETE FROM TableNameToDeleteFrom
WHERE FilterColumnName = 'FilterValue'
;
-- Purpose:
-- To provide a simple cheat sheet for netezza
-- VersionHistory
-- 1.0.0 --- ysg --- Initial creation
No comments:
Post a Comment
- the first minus - Comments have to be moderated because of the spammers
- the second minus - I am very lazy at moderating comments ... hardly find time ...
- the third minus - Short links are no good for security ...
- The REAL PLUS : Any critic and positive feedback is better than none, so your comments will be published sooner or later !!!!