-2

when I use command select :

select * from joueur 

the display of the table:

NUJOUEUR NOM
---------- ------------------------------------------------------------
PRENOM                              ANNAISS
------------------------------------------------------------ ----------
NATIONALITE
------------------------------------------------------------
16 MARTINEZ
Conchita                               1972
Espagne

What is the command to have a table like this:

 NUJOUEUR  NOM    PRENOM    ANNAISS   NATIONALITE
 ------------------------------------------------------------
 16      MARTINEZ Conchita  1972      Espagne
Dan Guzman
  • 43,250
  • 3
  • 46
  • 71
Classe Ensi E
  • 45
  • 2
  • 10
  • You *must* understand that **a table is an unordered set of rows**. Without a proper `order by` clause, the RDBMS is allowed to return the rows in any order -- there is even no ganrantee that two consecutive queries will return the rows in the same order. – Sylvain Leroux Mar 29 '15 at 17:59
  • `set linesize 32000` –  Mar 29 '15 at 18:59

2 Answers2

0

Use a order by clause along with a sorting direction asc | desc your query to maintain a specific order like below. Otherwise, any specific order is never guaranteed.

select * from joueur order by some_column asc;

There is no default order maintained. Check this post SQL: What is the default Order By of queries?.

EDIT: Per your edit in post; it's just a problem with your screen / console window width. Increase, your console window size and you should get all the column in a line as desired.

Community
  • 1
  • 1
Rahul
  • 76,197
  • 13
  • 71
  • 125
0

It is not disordered. This is only the display of very long lines that wrap. You need one of the several COLUMN options to fix that to your taste.

For example, to change the display width of the column NOM to 10 chars, you will write:

COLUMN NOM FORMAT A10
/

You will have to adjust that way the format of all your columns until it suits your needs. Last, but not least, if it is acceptable to truncate your data, you will need to set WRAP to OFF:

SET WRAP OFF
/

(If you need to fine tune the wrapping on a column basis, COLUMN has the
WRA[PPED] | WOR[D_WRAPPED] | TRU[NCATED] option. Please
refer to the doc for more details)

Sylvain Leroux
  • 50,096
  • 7
  • 103
  • 125