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 wrote a simple code to create a table in SQL. It is generating errors I am unable to understand even though I am sure the syntax are correct. Here is the output of my problem in the image:
Your query should be like below :
CREATE TABLE Users (
name varchar(128),
email varchar(128)
)
I highly recommend you to avoid using reserved words like Users.
A guide to help you creating tables.
As far as I get, the SQL syntax uses no curly braces, but just braces.
Have a look at this:
https://www.w3schools.com/sql/sql_create_table.asp
In fact, I would recommend you to use W3 schools for every extremely simple question like this one.
Create Table Users(
Name varchar(50),
Email varchar(100)
);
You should use () this brackets not {} this
Related
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 months ago.
Improve this question
I have two tables: userdata and videodata. I have the email as the primary key in the first table (userdata) and I want to use email in the second table (videodata) as a foreign key.
userdata table-
Whenever I execute the query for the videodata table creation, I get this error-
Here is the query for creating videodata table-
LIKE is a reserved word. Enclose it in back ticks.
create videDate (
...
`like` int,
...
);
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.
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.
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 5 years ago.
Improve this question
I have a list of zip codes in this format:
ZIP CODES
84038-4323
93434-4320
The user types it in like this: 84038
I'm trying to figure out how to do something like this in MySQL
SELECT * FROM locations WHERE ZipCode STARTSWITH '${userZip}'
I need the first part of the zip code to match exactly.
I tried this
SELECT * FROM locations WHERE ZipCode LIKE '${userZip}%'
But it's returning extra data, it appears the LIKE command is not strict enough.
I think you should consider using - too in where condition. Something like below using REGEXP
SELECT * FROM locations WHERE ZipCode REGEXP '^{userZip}-'
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 8 years ago.
Improve this question
Any thoughts on why WHERE clause would not work? I have made sure I have double checked the coding and spelling etc. It will not work with a simple WHERE clause, and I have tried using different operators, operators that I know are in the table. I have tried using trailing spaces, I have copied and pasted the output from SELECT DISTINCT column_name FROM table. In short I have really made sure that it is not just some dumb error on my part before posting this question.
Here are the specs of the column that is giving me trouble. UTF8_General_Ci and it VARCHAR(100).
I have never had any problems with a WHERE clause, not like this at least. Any thought? Thanks in advance
Here is the code;
SELECT site_specialty
FROM site WHERE site_specialty='INTERNAL MEDICINE'
there is no error message, it just comes up blank 0 rows returned
try this
SELECT site_specialty FROM site WHERE site_specialty LIKE '%INTERNAL MEDICINE%'
Before giving up entirely, I would try:
SELECT site_specialty
FROM site
WHERE upper(site_specialty) like '%INTERNAL%MEDICINE%';