SQL format

Jul 9, 2020 at 2:13pm
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 Jul 9, 2020 at 2:16pm
Jul 9, 2020 at 7:52pm
are you asking how to generate them in c++ and in columns that are aligned? Its hard to make sense of your question.
Jul 10, 2020 at 5:52am
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.
Jul 10, 2020 at 6:12am
At Salem, yes i mean like that!

(I also like to write C++ code in that style)
Jul 11, 2020 at 11:45pm
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.