Asking
Only logged in members can reply and interact with the post.
Join SimilarWorlds for FREE »

Anyone familiar with MySQL. Why DELETE FROM doesn't work but ;DELETE FROM works?

This page is a permanent link to the reply below and its nested replies. See all post replies »
MartinTheFirst · 26-30, M
;DELETE FROM means youre starting a new line
Riemann · 31-35, M
@MartinTheFirst The material I'm following doesn't have that ;
MartinTheFirst · 26-30, M
@Riemann you dont need to write ";" unless you have multiple rows of queries I think
MartinTheFirst · 26-30, M
@Riemann You can divide one single command into multiple rows for ease of reading, but that makes it so that the code compiler needs the end of line character ";" to correctly parse your code.
Riemann · 31-35, M
@MartinTheFirst Tried that. Pls check the sc in a comment where I mentioned u.
MartinTheFirst · 26-30, M
@Riemann you need to select something first. You can do SELECT * FROM which means select all that match [image deleted]
MartinTheFirst · 26-30, M
@Riemann aah you're doing a delete, nvm.

look
[image deleted][image deleted]
MartinTheFirst · 26-30, M
@Riemann [image deleted]
Riemann · 31-35, M
@MartinTheFirst Trying to delete a row. The Select and delete shows greensign with 0 rows being affected
Riemann · 31-35, M
@MartinTheFirst This is the full set of codes that are trying:

CREATE DATABASE mydb;
USE mydb;
CREATE TABLE mytable
(
id int unsigned NOT NULL auto_increment,
username varchar(100) NOT NULL,
email varchar(100) NOT NULL,
PRIMARY KEY (id)
);
INSERT INTO mytable (username, email )
VALUES ( "myuser", "myuser@example.com" );
UPDATE mytable SET username="myuser" WHERE id=8
DELETE FROM mytable WHERE id=8
MartinTheFirst · 26-30, M
@Riemann dude again you need to write ";" at the end of each command