0

I am very new at SQL, and it is my first code. This code was successfully executed at oracle live ide when I was in the classroom, Now I downloaded datagrip and PostgreSQL. and it shows the error given. please help me out. error is in line of desc.

My code:

create table students(
    StudentId int,
    Name char(250),
    age int
);

desc students

Error:

postgres.public> desc students
[2021-10-09 22:18:49] [42601] ERROR: syntax error at or near "desc"
[2021-10-09 22:18:49] Position: 1
  • `int()` is an invalid [data type specification](https://www.postgresql.org/docs/current/datatype.html). And [as documented in the manual](https://www.postgresql.org/docs/current/static/sql-commands.html) `desc` is not a valid SQL command. –  Oct 09 '21 at 17:19
  • 1
    Additionally: [don't use char](https://wiki.postgresql.org/wiki/Don%27t_Do_This#Don.27t_use_char.28n.29) –  Oct 09 '21 at 17:19
  • DESC (describe) is an `Oracle SQL*Plus` command, as indicated not a SQL statement. The closest corresponding command for Postgres is the `psql \d` command. – Belayer Oct 11 '21 at 23:23

0 Answers0