News for hackers. Stuff that matters.
Re:Show HN: SQL Police Department – Learn SQL while solving ... by mulmen on Monday May 04, 2020 @09:55PM (#23075552)

  SELECT Email
  FROM mailing_list
  ORDER BY JoinDate

  SQL Error: There is no field named JoinDate in the resulting FROM table.
Ok? What engine is this using? That's valid SQL in my universe.

In PostgreSQL 12:

  mulmen@shell> psql
  psql (12.1)
  Type "help" for help.

  mulmen=# CREATE TABLE foo ( bar INT, baz INT );
  CREATE TABLE
  mulmen=# INSERT INTO foo VALUES (1, 10), (2, 20);
  INSERT 0 2
  mulmen=# SELECT bar FROM foo ORDER BY baz;
   bar
  -----
     1
     2
  (2 rows)

  mulmen=#
Re:Show HN: SQL Police Department – Learn SQL while solving ... by doronlinder on Tuesday May 05, 2020 @07:39AM (#23078929)
Thank you for the feedback. The SQL parsing is home made and I assumed fields in the order by clause is also a part of the SELECT. I collect a window of failed queries in memory (without knowing who sent what) to find cases like this and fix them.
Re:Show HN: SQL Police Department – Learn SQL while solving ... by rpunkfu on Monday May 04, 2020 @11:10PM (#23076047)
Syntax is fine, it's complaining because you didn't include `JoinDate` column in your query.
Re:Show HN: SQL Police Department – Learn SQL while solving ... by mulmen on Tuesday May 05, 2020 @12:01AM (#23076353)
This appears to be a syntax error. I get a different error if I add JoinDate to the SELECT clause without adding the other columns it wants.