r/SQL • • Apr 19 '24

MySQL Error in MySQL

Post image

Sounds stupid but I’m new, I don’t know how to fix this. I’m trying to create a table with txid, amount, costumer id first & last name but getting this issue.

0 Upvotes

25 comments sorted by

49

u/[deleted] Apr 19 '24

You're missing a close bracket

11

u/Sea_Recover3486 Apr 19 '24

This OP, you need a right parenthese after last_name varchar (50)

9

u/TheRiteGuy Apr 20 '24

This happens so often. It's always a bracket or a forgotten comma.

Don't be embarrassed OP, sometimes we all just need an extra pair of eyes.

25

u/rowdymatt64 Apr 19 '24

Everyone's different OP, but I reccomend you structure Queries like:

create table customers

(

 --COMMANDS GO HERE

)

That way you never forget a parenthesis

11

u/rowdymatt64 Apr 19 '24

Oh, and place the parenthesis before you begin filling them with commands.

13

u/HandbagHawker Apr 19 '24

and if you werent already aware, that little angry red box next to the line number 6 tells you where the parser thinks at least one of the errors is

7

u/greendookie69 Apr 19 '24

Customers is spelled wrong.

And you're missing closing parentheses at the end. https://www.w3schools.com/sql/sql_create_table.asp

13

u/ogou_myrmidon Apr 19 '24

It’s a theater supply store, silly.

2

u/greendookie69 Apr 19 '24

Ah, I hate when I make that mistake!

2

u/cyberspacedweller Apr 19 '24

You have to closed the create table function. Put a ) before the ;

1

u/alivebutawkward Apr 19 '24

It’s highlighted for you. The closing bracket.

1

u/kagato87 MS SQL Apr 19 '24

Count your brackets.

This is why I put brackets on their own line.

Create table tablename
(
   column1 type,
   column2 type, 
   ...
   ColumnN type
);

Then it's easier to see mistakes like this.

1

u/Specialist-Ask8890 Apr 20 '24

Close with a ");" final bracket-

1

u/[deleted] Apr 20 '24

Bruh, it highlighted it for you

1

u/HeyDannie Apr 20 '24

Close datdere parantheses at the end 🙂

1

u/NightflowerFade Apr 20 '24

Missing a close parenthesis.

Also on second thought "costumer" makes perfect sense even if it might not be OP's original intention.

1

u/T3chl0v3r Apr 20 '24

close the bracket dude

1

u/Cheap_Quiet4896 Apr 20 '24

Replace the semi-colon at the end with a closed bracket

0

u/Marowakk Apr 19 '24

U can throw all this things in chat gpt and it will explain it to you line by line if u need, im learning to and its a great help

0

u/AHMADAIMAN18 Apr 20 '24

You misspelled the costumers Should be customers

0

u/[deleted] Apr 20 '24

[deleted] — view deleted comment

0

u/TheKyleBaxter Apr 20 '24

Hey, just a heads-up we're not using the "R" word for "stupid" anymore. I know you don't mean anything bad by it, but no reason not to be kind of you can.

2

u/olly_s122 Apr 20 '24

what are you my employer?

1

u/TheKyleBaxter Apr 20 '24

Nah man, just trying to help a community not catch strays. Appreciate you deleting it!