Error in SQL Syntax [closed] - mysql

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 7 years ago.
Improve this question
I'm trying to write a query to delete a raw in a database. This is the query:
"delete from ombrellone where PosizioneX='"+i+"'AND PosizioneY='"+j+"')");
I don't know what I wrong. Anyone can help me?
The exception is:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1

"delete from ombrellone where PosizioneX='" + i + "' AND PosizioneY = '" + j +"'";

Related

mySQL workbench- 'SELECT * FROM table' not working [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 2 years ago.
Improve this question
I don't have much experience with mySQL but I thought I knew the basics. However, I am clearly missing something. I am using a database that has 6 tables, I can look at 5 of them with no problem. I was looking for some values and I wasn't sure which exact table it was in so I typed in my mySQL 101 level statement- 'SELECT * FROM project', received the values, and saw that my target was not in there. So I next ran 'SELECT * FROM release' except that command does not work.
The MySQL Workbench underlines the word 'SELECT' and the tooltip message says- "select" is not valid at this position for this server version
When I attempt to run the command, I get Error Code: 1064. You have an error in your SQL syntax
So I tried deleting and rewriting, thinking it was some sort of bug but restarts and everything else I have tried is not helping and I have been unable to google anything relevant.
full command-
USE scorecarddb;
SHOW TABLES;
SELECT * FROM release;
but I usually just use the 1 line command run (aka I only run line 3 since I am already in the scorecard db). And I don't think it is an actual syntax error because if I change the word 'release' to 'project' or any of the other table names, it works
release might be a reserved keyword. Try using:
SELECT * FROM `release`;

How to delete data in MySQL from SQL Server? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 3 years ago.
Improve this question
I have few tables in MySQL and I wanted to delete data in those MySQL tables from SQL Server. Do we have any approach to perform it?
You can perform Insert/Update/ Delete/ Select using Linked Server in the SQL Server. You just need to create MySQL LinkedServer and use Open Query.
Sample Query:
DELETE FROM OPENQUERY([MYSQL_LOCAL], 'SELECT user_id FROM d_portal.users' ) where user_id = 1;
MYSQL_LOCAL is a MySQL Linked Server.
You can follow the below Article for better guidance.
https://www.sqlshack.com/mysql-query-t-sql-tutorial-for-sql-server/

i try to query data where like and where [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
this error
2 errors were found during analysis.
This type of clause was previously parsed. (near "WHERE" at position 64)
Unrecognized statement type. (near "WHERE" at position 64)
SQL query: Documentation
SELECT * FROM helpdeskrequest
WHERE detail LIKE '%New PC%'
AND WHERE type='HW'
MySQL said: Documentation
1064 - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'WHERE type='HW'' at line 2
{SELECT * FROM helpdeskrequest
WHERE detail LIKE '%New PC%' AND WHERE type='HW'}
You don't need the double WHERE:
SELECT * FROM helpdeskrequest
WHERE detail LIKE '%New PC%' AND type='HW'

Is it possible to perform SQL injection on a server that is using a database other than MySQL? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
If the database used by a server is something other than MySQL, say Mongo DB, then is it possible to execute SQL queries? In such cases how can we perform SQL injection?
I don't expect all the possible commands, but some basic commands if the app is using, say MongoDB.
Yes. This type of attack is possible with any data source which parses queries. In the case of MongoDB, the queries are written in JavaScript instead of SQL but if you build your query like this:
String query = "db.users.find({ age: " + request.getParameter("age") + " });"
then you open the database to similar kinds of attacks.
This is nosql injection, and it is possible.
https://www.owasp.org/index.php/Testing_for_NoSQL_injection

mysql count distinct syntax [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 8 years ago.
Improve this question
I'm trying to pull a simple count distinct from a table in MySQL. The query is the following:
select COUNT (DISTINCT column1) as distinctVol
from table1
The error I'm getting is below:
Error: You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use
near 'DISTINCT call_reference) as distinctVol
from dlr_calls_hist' at line 1 (State:37000, Native Code: 428)
I've already tried in various different ways, but I can try things again upon suggestions, to make sure it's not typo related.
I've also given it a go with an online SS to MySQL converter (I'm used to using SQL Server), which just spat back the same syntax.
Yes, I could potentially output data and import it into SQL Server, which is the final aim of my efforts, but first I would need to create the dataset as the entire db in MySQL is too large with quite a bit of unnecessary info - trying to keep the resource waste to minimum.
All ideas welcome, and thank you in advanZe!
In MySQL, when using aggregate functions, you can't have whitespace between the function name and the (. Change to:
SELECT COUNT(DISTINCT column1)
FROM table1
DEMO