skip to Main Content

Essentially I want to create a view in mySQL (phpmyAdmin) that queries a table called Equipment for a date range >=2018-12-1.

This is currently what I have, it is what is wrong with my syntax?

CREATE VIEW "Equipment_Date" AS SELECT * FROM "Equipment" 
WHERE "Ship_Del_Date" >= 2018-12-1;

2

Answers


  1. Use these to specify databases, tables and columns: `

    And not these: “

    Or simply just don’t use any of these, if not necessary.

    Then your SQL query will probably look like this:
    CREATE VIEW Equipment_Date AS SELECT * FROM Equipment WHERE Ship_Del_Date >= 2018-12-1;

    Login or Signup to reply.
  2. Below query should work provided Ship_Del_Date column has datatype as DATETIME.

    CREATE VIEW Equipment_Date AS SELECT * FROM Equipment
    WHERE Ship_Del_Date >= '2018-12-1';
    

    Use backticks instead of single quotes to enclose the table,column names only when the names are from mysql reserved keywords.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search