Hi there, i am using sqlite3 online compiling. I wanted to create a table where one of the employee has a value of unknown salary.
Here are my sqlite3 codes.

where John Doe works at Burger Steak but his salary is unknown.

BEGIN TRANSACTION;
/* Create a table called Works */
CREATE TABLE Works(employee_name text, company_name text, salary varchar);

/* Create few records in this table */
INSERT INTO Works VALUES('John Smith', 'Starbucks Coffee', '2000 USD');
INSERT INTO Works VALUES('Peter Cruz', 'Mc Donalds', '3000 USD');
INSERT INTO Works VALUES('John Doe', 'Burger Steak', '');
COMMIT;

The output is

John Smith|Starbucks Coffee|2000 USD
Peter Cruz|Mc Donalds|3000 USD
John Doe|Burger Steak|

Am i doing this right? Is the unknown salary should be leave blank? what about NULL values, how i could apply it here.

You aren't entering a NULL value for John Doe, you're entering an empty string which is not the same as NULL.
INSERT INTO Works VALUES('John Doe', 'Burger Steak', null);

would result in
John Doe | Burger Steak | NULL

thank you so much i think that is the statement im searching for. I've been trying also

INSERT INTO Works (
    employee_name,
    company_name,
    salary
) VALUES (
    'John Doe',
    'Burger Steak',
    'NULL'
);

i was wrong in putting qoute. thank you so much for the enlightenment

cough solved? ;)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.