• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

select * from

 
akol ompen
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I try this code from a video https://www.youtube.com/watch?v=7Vtl2WggqOg but i failed to do it .I use http://sqlfiddle.com/#!9 and after this site  http://www.w3schools.com/sql/trysql.asp?filename=trysql_select_all but i failed to do it like she does on the video.I cant find my mistake or she is doing it wrong?or this online sites isnt good?
 
akol ompen
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i tried and this but also i failed
 
Tim Moores
Bartender
Posts: 3127
50
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What does "I failed to do it" mean? What, exactly, did you do, and what, exactly, were the results? Post all system messages or errors you may have got in full.
 
akol ompen
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tim Moores wrote:What does "I failed to do it" mean? What, exactly, did you do, and what, exactly, were the results? Post all system messages or errors you may have got in full.
on this site http://sqlfiddle.com/#!9/c6bc3 first message i press button build schema.It says "ready schema" after i press  "run sql" and nothing happens.I go the other site http://www.w3schools.com/sql/trysql.asp?filename=trysql_select_all and nothing happens..
 
Tim Moores
Bartender
Posts: 3127
50
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I see, the question isn't so much about SQL as it is about those sites. Sqlfiddle doesn't work for me either in a quick test, but w3schools returns results when I click the "Run SQL" button with the prepopulated query.
 
akol ompen
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tim Moores wrote:I see, the question isn't so much about SQL as it is about those sites. Sqlfiddle doesn't work for me either in a quick test, but w3schools returns results when I click the "Run SQL" button with the prepopulated query.
prepopulated query : you mean that it work the codes i gave it ?(because i tested i again the codes in w3school but nothing for me).
 
Tim Moores
Bartender
Posts: 3127
50
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, I meant it works with the query that is in the text field when you open the page. In Firefox it apparently uses a read-only DB, so you can't create tables or insert data (there's a message to that effect if you try).

In Safari, I can create a table, and then insert data one record at a time, and then finally query it successfully. Apparently, you can enter only a single statement at a time.

Chrome and Opera should also work, according to the error message in Firefox.
 
Tim Holloway
Saloon Keeper
Posts: 18359
56
Android Eclipse IDE Linux
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, we don't have enough information to know why you think it failed (telling us the error message would be nice).

But I do see one glaring issue:



No, it's not that "Banannas" is misspelled, it's that "Banannas" is wrapped in double-quotes.

In SQL the standard is single quotes. That is, the statement should look like this:


Double-quotes are not interchangeable with single-quotes in SQL. Use of double-quotes in SQL is somewhat non-standard, but usually used for wrapping the names of reserved words used in a non-reserved way or to indicate that a field, table, or schema name is case-sensitive (which isn't normally true in SQL).

When you're referring to data values, use single-quotes.
 
Tim Moores
Bartender
Posts: 3127
50
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In SQL the standard is single quotes.

Good point, although that SQL editor does actually allow the use of double quotes. But best not to get into the habit.
 
akol ompen
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tim Moores wrote:
In SQL the standard is single quotes.

Good point, although that SQL editor does actually allow the use of double quotes. But best not to get into the habit.
i am very thankful about your help you give me
 
Brian Tkatch
Bartender
Posts: 567
25
Linux Notepad Oracle
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tim Moores wrote:
In SQL the standard is single quotes.

Good point, although that SQL editor does actually allow the use of double quotes. But best not to get into the habit.

Wow. Do NOT use double-quotes for literals! Double-quotes often specify object names (and preserve case for them). Very bad idea to use double quotes! Always use single-quotes for text literals.

Good catch guys!
 
akol ompen
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
unfortunately http://imgur.com/a/yWZrA i try it and i failed again on mozilla :/
 
Tim Moores
Bartender
Posts: 3127
50
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not sure what you mean by "on mozilla", but as I said, the editor apparently can handle single statements only. So try that instead of multiple statements at a time.
 
akol ompen
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tim Moores wrote:Not sure what you mean by "on mozilla", but as I said, the editor apparently can handle single statements only. So try that instead of multiple statements at a time.
https://kripken.github.io/sql.js/GUI/ i did it on this site .I think its much better and it worked fine
 
Tim Holloway
Saloon Keeper
Posts: 18359
56
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Invalid create statement". A message so clear and informative that's it's worthy of Oracle or IBM. 

I'd have to go back and check, but I don't think that "INTEGER" is a standard SQL datatype. If memory serves me correctly, the SQL standard would be "NUMERIC".

Note that Your Mileage May Vary depending on what DBMS you use. Different DBMS's add different extended data types and some even support user-defined data types.
 
Brian Tkatch
Bartender
Posts: 567
25
Linux Notepad Oracle
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
akol ompen wrote:
I try this code from a video https://www.youtube.com/watch?v=7Vtl2WggqOg but i failed to do it .I use http://sqlfiddle.com/#!9 and after this site  http://www.w3schools.com/sql/trysql.asp?filename=trysql_select_all but i failed to do it like she does on the video.I cant find my mistake or she is doing it wrong?or this online sites isnt good?

After removing the "//" until the end of the line, it worked for me in SQL Fiddle on Firefox.


Also here, and can make the image larger.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic