Multiple row insert in a mysql table [closed] - mysql

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 7 years ago.
Improve this question
Hi I need to update multiple rows in a table so I wrote below query, but it only updates the first row and not the others. Please help.
Query:
String sql = "REPLACE INTO subscriber_metadata (msisdn, have_had_speech_pkg, have_had_sms_pkg, created, changed) values ";

Well REPLACE INTO does the following DELETE + INSERT, what you're looking for is UPDATE, doc over here

REPLACE INTO is nothing more than a mechanical DELETE and INSERT. It can incite mysqld to address deadlocks (See my answer to How I prevent deadlock occurrence in my application?)

Related

Not able to delete complete row in SQL [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed last year.
Improve this question
Wanted to delete complete row, which contains NULL entries in sql with command
DELETE FROM student WHERE ID=NULL;
What is wrong in this code?
Your syntax is incorrect you need to check for IS NULL
DELETE FROM student WHERE ID IS NULL;
Adding link to documentation thanks to D M
Working with NULL values

(SQL) WHERE clause not working in its most simple way? [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 3 years ago.
Improve this question
SQL beginner here. I have this database: https://github.com/socratica/data/blob/master/earthquake.csv
I'm running a simple Query such as:
SELECT place, DEPTH1 , OCCURED_ON from EARTHQUAKE1;
I execute it, and get the info I need. However, when I add WHERE depth1 = 35; (I edited the depth col just in case it was conflicting with some other clause)
the GUI returns an error. I tried adding ' and using like, also using TRIM but no luck. I also tried retrieving data from another col, but still no good. What is it that I'm doing brutally wrong?
Thanks in advance!
You have a semicolon after your FROM and before your WHERE.
SQL is reading the WHERE as a separate statement and failing.
The ; is a statement terminator.

SQL expecting 'with' command [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 3 years ago.
Improve this question
I started using MySQL recently and I am facing a problem. I created two tables using create table command and inserted value in the table. These two commands were executed successfully. Then I tried using select command. When I try to execute this command it shows
"select" is not valid at this position for this server version, expecting: (, WITH
Here is my command:
select
*
from Employee,
where Gender="M" and NativePlace="Mumbai",
order Hobby by desc;
What is the reason for this?
There are a couple of syntax errors in your query, try this:
select
*
from Employee
where Gender='M' and NativePlace='Mumbai'
order by Hobby desc;
Remove the commas after Employee and "Mumbai" and you should be good.

where statement not working only for a particular column in a sql query [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 3 years ago.
Improve this question
Hi I am trying to make a very basic sql query from a mysql table.
SELECT VAV,floor from Mapping limit 10;
output is
But when I try with
SELECT VAV,floor from Mapping where floor='B2WL1';
It outputs an empty set. I am very surprised with this. I have also tried with spaces like
SELECT VAV,floor from Mapping where floor=' B2WL1';
SELECT VAV,floor from Mapping where floor='B2WL1 ';
it is returning empty set. Can someone help me with this. Really stuck at this.
try:
where floor like '%B2WL1%';
Probably has whitespaces or any other hidden characters
you may try with wild characters like
SELECT VAV,floor, LENGTH(floor) as number_of_characters
from Mapping
where floor like '%B2WL1%';

SQL INSERT INTO Syntax error. Basic Database [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 6 years ago.
Improve this question
I'm attempting to insert a new row into a table and I am getting a syntax error. I successfully inserted rows into different tables in the same database withe the same format with no issues. The scrip is as follows
INSERT INTO Ordertbl(OrdNo, OrdDate, CustNo, EmpNo, OrdName, OrdStreet, OrdCity, OrdState, OrdZip)
VALUES ('O1234567', '2030-1-25', '49908905', '55138445', 'John Smith', 'Milwaukee', 'WI', '53122-4523')
You specified nine columns but only eight values. You're missing the street.