简体   繁体   中英

Is it possible to insert column in the first postion with sas/sql

When I add a column to my my table with alter table , it is inserted as the last record. Is there a way to insert the column into the position I choose?

Thank you.

Some dbms let you control the column position with an alter table statement, but most do not. MySQL is one that does . Assume you start with

create table table_name (b char(1), d char(1));

You can alter that table to put column a first, and alter it again to put c after b.

alter table table_name add column a char(1) first;

alter table table_name add column c char(1) after b;

All dbms support "reordering" columns using create view... and select... though.

In the relational model of data, the order of columns is irrelevant. But I know what it's like to work in companies where that irrelevance is irrelevant.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM