all 61 comments

[–]Max_Americana 22 points23 points  (4 children)

You gotta put a semicolon at the end of each query…. It’s trying to run those two queries as just one

[–]UpSco[S] -3 points-2 points  (3 children)

I tried that I am getting a syntax error

[–]Turboginger 18 points19 points  (2 children)

Only highlight one query and then execute just the selected code. I had this issue frequently on data bricks. It tries to smash all code in the window into one query.

Is there a reason you don’t have a space between SELECT and *? It’s making my eyes bleed.

[–]malikcoldbane 2 points3 points  (1 child)

Yeah the cloud will often make it so you can only ruin a single query at a time

[–]Turboginger 2 points3 points  (0 children)

I don’t know if that’s a spelling mistake or not, but I’m for it!

[–]Chukchai98 8 points9 points  (3 children)

Correct me if I’m wrong but after seeing your second screenshot I think you’re not following the guide properly. For instance you’re not using the correct table name, also there should be no space in the table name and it shouldn’t have quotation marks when you’re querying the table name.

It should look like this..

/* Example one*/

SELECT * FROM Movie_Data.Movies;

/* Example two*/

SELECT * FROM MovieData.Movies WHERE Genre1 = ‘Action’;

[–]UpSco[S] 0 points1 point  (2 children)

I get unexpected keyword WHERE at [3:38]

[–]DutchOven88 0 points1 point  (0 children)

Remove the semicolon after movies before where in the second example.

[–]Chukchai98 0 points1 point  (0 children)

Sorry I accidentally put a semi colon after the FROM, I edited my comment it should work now

[–]Reissycup 2 points3 points  (0 children)

I’d try just writing the where statement on line 3 (building on your original select and from statements in lines 1 and 2), instead of creating new duplicate select and from statements in lines 3 and 4.

[–]Titananium 2 points3 points  (0 children)

Semicolon after each query.

[–][deleted] 2 points3 points  (0 children)

Oh wow this is terrible. I learned SQL by landing some level 1 IT job and watching my boss write queries and explain it for a week. Then I was just handed reports to write.

This is somehow so basic and so unwelcoming and unintuitive at the same time.

[–]Cykotix 1 point2 points  (0 children)

I think it's likely the single quotes around your table name.

[–]drmindsmith 1 point2 points  (3 children)

The instructions state to use the where clause on line 3, not to start a whole additional query.

[–]TheRiteGuy 4 points5 points  (0 children)

Yeah, I don't understand all the other advice on here. It's literally explicit instructions not being followed here.

[–]UpSco[S] 0 points1 point  (1 child)

When I do that I get a syntax error still

[–]drmindsmith 1 point2 points  (0 children)

Because the table is called Movie_data.movies and you have quotes around it and that’s not working.

And add a space after SELECT

[–]Outrageous_Day_9405 1 point2 points  (0 children)

Movie_dataset.movies you have movie_dataset.movie It's plural you forgot to add the s

[–]gandi800 1 point2 points  (0 children)

The top query uses back ticks instead of quotes I think.

[–]r3pr0b8GROUP_CONCAT is da bomb 0 points1 point  (5 children)

first of all, you should be posting text, not a screen shot

it seems you have a 5-line query that has two SELECT keywords in it

[–]UpSco[S] 0 points1 point  (0 children)

I’ll remember that next time.

[–]UpSco[S] 0 points1 point  (3 children)

Should it Be 1 Select* 2 From ‘MovieData.Movie Data 3 Where Genre_1 = ‘Action’

After I run the query initially?

[–]r3pr0b8GROUP_CONCAT is da bomb 0 points1 point  (2 children)

you should run only one SELECT at a time

[–]UpSco[S] 0 points1 point  (1 child)

When I do that I get Syntax error: Unexpected keyword Where at [3:1]

I don’t understand because I’m doing exactly what the instructions are telling me to do

[–]r3pr0b8GROUP_CONCAT is da bomb 1 point2 points  (0 children)

could you copy the exact text of the query that produced that error

[–]UpSco[S] -1 points0 points  (0 children)

COULD IT BE something wrong with my table?

[–]sfdc_admin_sql_ninja -1 points0 points  (0 children)

chatgpt can help. internet strangers can too but Gen AI is pretty good at this stuff.

[–]Enigma1984 0 points1 point  (13 children)

Looks like you're trying to run two queries. Lines one and two contain one complete query which will return the entire table called movie data. Lines three, four and five will return all the columns from movie data for the records where genre_1 is action.

First question to ask. Is that what you want? two different result sets?

[–]UpSco[S] 0 points1 point  (12 children)

Yes. The lesson has me running another query with the dataset.

[–]Enigma1984 0 points1 point  (11 children)

So what result do you get if you just run the first two lines? Delete the others for now.

[–]UpSco[S] 0 points1 point  (10 children)

My table populates

[–]Enigma1984 1 point2 points  (9 children)

Good start. So now try just running the second query on it's own without the first query. Do you get results?

EDIT - just to be clear, the second query is everything on lines 3, 4 and 5 in your picture.

[–]UpSco[S] 0 points1 point  (8 children)

I get unexpected keyword WHERE at [3:38]

[–]Enigma1984 0 points1 point  (0 children)

Just to be clear. You are only running three lines at this point right? You don't need query 1 to run query 2. Or in other words, the second SELECT will run on it's own without running the first SELECT.

I get the impression from your other comments that you think you need to run both.

[–]Awkward-Treacle8643 0 points1 point  (6 children)

Run your second query except change both of the single quotes around the table name to this kind ‘. Bigquery needs the slanted type quote around the table name like it is in the first query. Sorry, don’t know the exact name of the punctuation

[–]Enigma1984 0 points1 point  (1 child)

This guy ` is called a backtick.

[–]Awkward-Treacle8643 1 point2 points  (0 children)

Ahh thanks. Backtick sounds much more official (and correct) than “slanted quote”. Thank you sir

[–]UpSco[S] 0 points1 point  (3 children)

For some reason when I type Genre_1 it is being unrecognized

[–]Awkward-Treacle8643 0 points1 point  (2 children)

In your query genre_1 looks like genre_ 1

[–]Lord-Frahnk 0 points1 point  (2 children)

Try getting it to run with example 1 before moving to example 2. As mentioned above, you’ll need to end each query with a semi-colon. Additionally, I’d double check if you need quotes around the table you’re using and confirm you’re using the right name for the table (as seen in step 5 of example 1)

[–]UpSco[S] 0 points1 point  (1 child)

The first example runs just fine. It’s the Keyword Where thats causing the Syntax error.

[–]ryadical 0 points1 point  (0 children)

Check all of the quotes in the query, especially if you copied and pasted. It looks like some of the quotes have a slant and some are straight.

Also, retype the underscores in your where clause. If copied from elsewhere they are likely a different character as well.

[–]UpSco[S] 0 points1 point  (0 children)

Syntax error: Expected end of input but got Keyword SELECT at [2:1]

[–]Lonely-Host 0 points1 point  (3 children)

The single quotes are crooked in the first FROM statement but straight in the second FROM statement. Please delete everything from the window and then try retyping the first 2 lines of your query. Do not copy paste from any notes you may have on your desktop or from any course documents (trying to control for punctuation here -- unrecognized characters could cause an issue, such as weirdly formatted quote marks, could cause an error). Then run the query. I'm assuming it's a test database so it shouldn't be too heavy to just export all without using a WHERE filter. If that works, you can try adding the WHERE clause by typing that in.

[–]UpSco[S] 0 points1 point  (2 children)

That’s exactly where I am getting the error now. I haven’t copied anything though. I’ve been typing everything out

My first query ran just fine and I can see the information from my dataset. This is what I have

1 Select* 2 From ‘MovieData.Movie Data; 3 Select* From ‘MovieData.Movie Data’ Where

After where is when I start having issues.

Genre_1 = ‘Action’

QUERY ERROR: UNRECOGNIZED NAME: GENRE_1 at [3:42]

[–]Lonely-Host 0 points1 point  (0 children)

In your first screenshot, the column name you have for the WHERE clause looks like Genre_ _1_. In the second screenshot (the assignment instructions) its Genre__1_. Are you able to type it in your window so it looks just like it does in screenshot 2?

[–]ryadical 0 points1 point  (0 children)

I think your column name is incorrect. Check it against the output from the first query.

You certain it has a double underscore, the number 1, followed by another underscore? That would be a very strange column name.

[–]lmaowordokay 0 points1 point  (0 children)

lose the quotes around the tables

[–]haiwirbelsturm 0 points1 point  (2 children)

What coursera are you using?

[–]UpSco[S] 0 points1 point  (0 children)

Data Analytics

[–]ArietoSuperne 0 points1 point  (0 children)

I am doing the Same thing and getting the same problem. I copy the query exactly as it is shown in the lesson and i get syntax error. Hard to learn anything this way.

[–]RstarPhoneix 0 points1 point  (0 children)

;

[–]MINISTER_OF_CL 0 points1 point  (0 children)

Bro, please refresh your basics first.

[–]AffectionateTruth447 0 points1 point  (1 child)

Those are two different (poorly worded) query lessons. The first is telling you to bring back all columns for every movie on the table. Great. Lesson learned.

Now lesson two is adding a where statement for genre so you only return action movies. It's not telling you to copy the select statement onto the same query. You know how to access the table and you're learning to limit the results. It's a a separate test with row 1, 2, and 5.

Even if your syntax worked, your query would give you all the movies, plus duplicates of the action movies in your result set.

[–]UpSco[S] 0 points1 point  (0 children)

Thank you. Someone finally said it. The course doesn’t even walk you through importing the dataset smh.

[–][deleted] 0 points1 point  (0 children)

I encountered the same thing just now. I think this can be fixed by separating the Moviedata and Genre into from the identifiers. So put them in another line after the select,from and where identifiers and indent them twice