SQL format

Via notepad i can write sql scripts like below:

create table recipient
(
id bigint(20) not null auto_increment,
account_number varchar(255) default null,
description varchar(255) default null,
email varchar(255) default null,
name varchar(255) default null,
phone varchar(255) default null,
user_id bigint(20) default null,
)

But how can write sql scripts such that varchar is one line bellow bigint but ecaxtly the same x coordinate as bigint above
Last edited on
are you asking how to generate them in c++ and in columns that are aligned? Its hard to make sense of your question.
Like this?
1
2
3
4
5
6
7
8
9
10
create table recipient
(
id              bigint(20)    not null auto_increment,
account_number  varchar(255)  default null,
description     varchar(255)  default null,
email           varchar(255)  default null,
name            varchar(255)  default null,
phone           varchar(255)  default null,
user_id         bigint(20)    default null,
)

Not that it matters to SQL, it's going to ignore all that whitespace anyway.
At Salem, yes i mean like that!

(I also like to write C++ code in that style)
This can easily be done through some sort of lint or alignment plugin for your editor. Or you can just do it manually...
Topic archived. No new replies allowed.