Adds or drops table columns and modifies column definitions.
Category: | Data Definition |
Restriction: | Constraint syntax is defined by the data source. The constraint syntax that is provided here is a general syntax. For complete constraint syntax, see the documentation for your data source. |
Supports: | EXECUTE Statement |
Data source: | SAS data set, Aster, DB2 under UNIX and PC, Greenplum, HAWQ, Hive, Impala, MDS, MySQL, Netezza, ODBC, Oracle, PostgreSQL, SAP HANA, Sybase IQ, Teradata |
Note: | Braces in the syntax convention indicate a syntax grouping. The escape character ( \ ) before a brace indicates that the brace is required in the syntax. Table options must be contained by braces ( { } ). |
specifies a table to modify. table can be specified in one of these forms:
is an implementation of the ANSI SQL standard for an SQL catalog. The catalog is a data container object that groups logically related schemas. It is the first-level (top) grouping mechanism in a data organization hierarchy that is used along with a schema to provide a means of qualifying names. A catalog is a metadata object in a SAS Metadata Repository.
is an implementation of the ANSI SQL standard for an SQL schema. The schema is a data container object that groups files such as tables and views and other objects that are supported by a data source such as stored procedures. The schema provides a grouping object that is used along with a catalog to provide a means of qualifying names.
is the name of the table.
Restriction | You cannot alter an MDS table while it is referenced in another transaction or statement. If a request fails, make sure other users are no longer using the table or have disconnected. |
Requirement | Table naming conventions are based on the data source. When more than one data source is involved, the maximum length of a table name is determined by the maximum length that is supported by all of the data sources and FedSQL. For example, if your data sources are a SAS data set that has a maximum of 32 characters and MySQL that has a maximum of 64 characters, the maximum length of a table name is 32 characters. For more information, see the documentation for your data source. |
specifies one or more table options and their respective values to apply to the table.
Requirement | The OPTION argument and all table options must be enclosed in braces ( { } ). |
See | FedSQL Statement Table Options |
specifies the name of a column in a table.
Requirement | Each column in a table must be unique. |
specifies to add a column to a table.
Data source | Aster, DB2 under UNIX and PC, Greenplum, HAWQ, Hive, Impala, MDS, MySQL, Netezza, ODBC, Oracle, PostgreSQL, SAP HANA, Sybase IQ, Teradata |
See | column and <column-definition> Arguments in the CREATE TABLE statement |
specifies to add an integrity constraint to one or more columns.
Data source | SAS data set, Aster, DB2 under UNIX and PC, Greenplum, HAWQ, MySQL, ODBC, Oracle, PostgreSQL, SAP HANA, Sybase IQ, Teradata |
Note | Constraint validation and enforcement is performed by the data source. You should be familiar with data source’s requirements before adding or dropping an integrity constraint. |
See | <column-constraint> and <table-constraint> Arguments in the CREATE TABLE statement |
specifies to modify the definition of one or more columns.
Data source | Aster, DB2 under UNIX and PC, Greenplum, HAWQ, MDS, MySQL, Netezza, ODBC, Oracle, PostgreSQL, Sybase IQ, Teradata |
See | <column-definition> Arguments in the CREATE TABLE statement |
specifies to delete the specified column from the table. When FORCE is specified, the column is dropped from the table without error processing. Use the FORCE keyword only when you are certain that dropping the column without error processing will not negatively affect the table.
Data source | Aster, DB2 under UNIX and PC, Greenplum, HAWQ, Hive, MDS, MySQL, Netezza, ODBC, Oracle, PostgreSQL, SAP HANA, Sybase IQ, Teradata |
See | column |
specifies to delete an integrity constraint.
specifies the name of the constraint to drop.
Data source | SAS data set, Aster, DB2 under UNIX and PC, Greenplum, HAWQ, ODBC, Oracle, PostgreSQL, SAP HANA, Sybase IQ, Teradata |
changes the specified table or column name to a new name. The new name follows the TO keyword.
Data source | Aster, DB2 under UNIX and PC, Greenplum, HAWQ, MDS, Netezza, ODBC, Oracle, PostgreSQL, SAP HANA, Sybase IQ, Teradata |
alter table personal_info add column em_num char(16);
alter table personal_info drop em_num;
alter table mytest add y char(5) constraint c2 unique;
alter table customers add constraint pkey primary key(custid);
alter table mytest add constraint chk check (col1 < 5);
alter table customers drop constraint _pk0001_;
alter table personal_info alter country set default 'UK';
alter table personal_info alter country drop default;
alter table sales rename column y to customers;