1

I'm fairly new to SQL (I learned it just yesterday). The DBMS application I am using is OpenOffice.org Base on Windows 10.

I created a table in my DBMS by the name of Employees, with several records. The Primary Key is EmployeeID (I'll attach a screenshot of the table for reference).

The problem is when I try to execute a code to delete the record with the EmployeeID "E001", I get an error message.

Code:

DELETE FROM "Employees"
WHERE "EmployeeID" = "E001";

This code seems simple enough to me. However, this is the error message I get:

1: Column not found: E001

I expected this to work, because I tried to use it on the w3schools.com online editor, and it worked (with a different database). I'll leave a link to it down below.

If this problem is exclusive to OOo Base, I can't do anything about it, since I need to use it for a school assignment.

Thanks in advance.

Employees Table

w3schools.com Online Editor

Slava Rozhnev
  • 9,510
  • 6
  • 23
  • 39
  • 2
    String literal values should usually be defined in **single quotes** : `... WHERE "EmployeeID" = 'E001'`; - double quotes denote table and column names – marc_s Jan 09 '22 at 09:19
  • Use single qoutes in literals 'E001' – Serg Jan 09 '22 at 09:20

1 Answers1

2

Quotes in a RDBMS are typically used for different purposes, as described in the comments above.

String literal values are always contained in 'single quotes', double quotes are typically needed as delimiters to identify object names where the name contains one of several non-standard characters or clashes with the name of a reserved word.

So double quotes are not necessary when naming a table Employees - but would be if for example the table's name was "order" since order is also a reserved keyword, or "Employee Status" since it contains a space.

Some databases have their own specific delimiters either instead of or an addition to double quotes, such as MySql which uses `backticks` or SQL Server that uses [square brackets].

jarlh
  • 42,561
  • 8
  • 45
  • 63
Stu
  • 30,392
  • 6
  • 14
  • 33