如何格式化我的SQL查询的输出以便很好地显示?

时间:2016-12-11 20:53:28

标签: sql sqlplus

我已经定义了自己的数据库来学习SQL(使用SQL * Plus通过SSH远程进入我学校的Linux机器)。但是,我很难很好地展示我的桌子,特别是这个:

CREATE TABLE customer_account 
(
  ACCOUNT_ID NUMBER(10) NOT NULL,
  PHONE_NUMBER VARCHAR(20) NOT NULL,
  EMAIL VARCHAR(100) NOT NULL,
  FNAME VARCHAR(100) NOT NULL,
  LNAME VARCHAR(100) NOT NULL,
  ADDRESS_STREET VARCHAR(50) NOT NULL,
  ADDRESS_CITY VARCHAR(20) NOT NULL,
  ADDRESS_STATE VARCHAR(2) NOT NULL,
  ADDRESS_ZIP VARCHAR(5) NOT NULL,
  BIRTH DATE DEFAULT NULL,
  PRIMARY KEY (ACCOUNT_ID)
);

INSERT INTO customer_account 
VALUES (1, '9174560091', 'jhunters01@cuny.edu', 'Jack', 'Hunter', '11 67ST', 'New York', 'NY', '10024', TO_DATE('1998/01/22 00:00:00', 'yyyy/mm/dd hh24:mi:ss'));
INSERT INTO customer_account 
VALUES (2, '7134560012', 'L.Larson@gmail.com', 'Linda', 'Larson', '100-9 Brooklyn Hwy', 'New York', 'NY', '11225', TO_DATE('1996/12/20 00:00:00', 'yyyy/mm/dd hh24:mi:ss'));
INSERT INTO customer_account 
VALUES (3, '5303056927', 'sciencerules@gmail.com', 'Albert', 'Newton', '1206 Francis Mine', 'Sacramento', 'CA', '95814', TO_DATE('2001/05/17 00:00:00', 'yyyy/mm/dd hh24:mi:ss'));
INSERT INTO customer_account 
VALUES (4, '5106204676', 'luvlucy@yahoo.com', 'Ricky', 'Ricardo', '90 maple street west', 'Trenton', 'NJ', '08861', TO_DATE('1942/12/01 00:00:00', 'yyyy/mm/dd hh24:mi:ss'));
INSERT INTO customer_account 
VALUES (5, '3237843058', 'RalphJRiggins@dayrep.com', 'Ralph', 'Riggins', '3373 Hillhaven Drive', 'Los Angeles', 'CA', '90017', TO_DATE('1964/10/02 00:00:00', 'yyyy/mm/dd hh24:mi:ss'));
INSERT INTO customer_account 
VALUES (6, '2133384287', 'lavonnaRWilliams@mail.com', 'Lavonna', 'Williams', '1305 Zimmerman Lane', 'City of Commerce', 'CA', '90040', TO_DATE('1983/03/03 00:00:00', 'yyyy/mm/dd hh24:mi:ss'));
INSERT INTO customer_account 
VALUES (7, '6313604478', 'antoninetteRe@gmail.com', 'Antoinette', 'Reynolds', '2329 Wayback Lane', 'Smithtown', 'NY', '11787', TO_DATE('1990/10/25 00:00:00', 'yyyy/mm/dd hh24:mi:ss'));
INSERT INTO customer_account 
VALUES (8, '9736948587', 'Mcdonald@yahoo.com', 'Berger', 'McDonald', '3024 Spring Haven Trail', 'Mountain View', 'NJ', '07470', TO_DATE('1960/06/17 00:00:00', 'yyyy/mm/dd hh24:mi:ss'));
INSERT INTO customer_account 
VALUES (9, '9082074677', 'M.Lester@gmail.com', 'Moe', 'Lester', '2980 Williams Mine Road', 'Lakewood', 'NJ', '08701', TO_DATE('1988/10/05 00:00:00', 'yyyy/mm/dd hh24:mi:ss'));
INSERT INTO customer_account 
VALUES (10, '8282351937', 'son@rhyta.com', 'Dam', 'Son', '98 McVaney Road', 'Canton', 'NC', '28716', TO_DATE('1957/08/28 00:00:00', 'yyyy/mm/dd hh24:mi:ss'));

每当我做的时候

SQL> SELECT * FROM customer_account;

无论我尝试什么,整张桌子都不会很好。我使用set linesize无济于事。这是我能做的最好的事情

enter image description here

实际表格中每列的内容是否过多,或者我可以采取哪些措施来解决这个问题?

1 个答案:

答案 0 :(得分:1)

我建议使用SQL开发人员 这是2个建议。

Oracle SQL Developer
http://www.oracle.com/technetwork/developer-tools/sql-developer/overview/index-097090.html

SQuirreL SQL
http://squirrel-sql.sourceforge.net/