My code for the first project on SQL (create a table) isn’t querying any results. It does show results after the first step, but then after that nothing else comes up. Is my code below correct?
Thanks for the help in advance
CREATE TABLE friends (
id INTEGER
name TEXT
birthday DATE
);
INSERT INTO friends (id, name, birthday)
VALUES (1,'Jane Doe','1990-05-30');
SELECT *
FROM friends;
INSERT INTO friends (id, name, birthday)
VALUES (2,'John Powers','1990-03-20');
INSERT INTO friends (id, name, birdthay)
VALUES (3,'Jack Stevens','1992-04-21');
UPDATE friends
SET name = 'Jane Smith'
WHERE id = 1;
ALTER TABLE friends
ADD COLUMN = email TEXT;
UPDATE friends
SET email = '[email protected]'
WHERE id = 1;
UPDATE friends
SET email = '[email protected]'
WHERE id = 2;
UPDATE friends
SET email = '[email protected]'
WHERE id = 3;
DELETE FROM friends
WHERE id = 1;
SELECT *
FROM friends;
```````
Rather than just give you the answer as to what’s wrong, I find it best to have you figure it out first.
When de-bugging code, it’s sometimes good to read it from the bottom up too. I do that and it gives you a different perspective.
Same goes for commenting out code and seeing what prints and what doesn’t. (b/c you’re not given any error messages in the LE for SQL here).
Without some idea of what you did and what you expected to happen it might be hard to assist. The earlier advice about trying this line by line to see what does/doesn’t work is a good place to start.
If you’re still stuck have a nosey through the following FAQ which details how to set up a question for the forums for your best chance of getting some help.