two typo errors: -- Add a named foreign key constraint to a new table //TYPO ERROR 1: should be unnamed CREATE TABLE transactions ( transaction_id INT PRIMARY KEY AUTO_INCREMENT, amount DECIMAL(5, 2), customer_id INT, FOREIGN KEY (customer_id) REFERENCES customers(customer_id) ); ALTER TABLE transactions AUTO_INCREMENT = 1000; -- Add a named foreign key constraint to an existing table ALTER TABLE customers //TYPO ERROR 2: should be transactions ADD CONSTRAINT fk_customer_id FOREIGN KEY (customer_id) REFERENCES customers(customer_id)
bro why u always have the BEST tutorials out there and as much as i search the whole yt i always end up warching YOUR vids?😂 keep up the good work man all of us IT students appreciate it. you are far better than our professors
True I share that point I even learned English to understand Him 😂😂 if I stay At home watching his videos I see much better than going to school wasting time and make my life miserable
Really frustrated till now trying to learn how primary key work. I have no idea how to insert multiple same column data (the assigment the gave me) meanwhile primary key doesn't work if you add duplicate data, besides that problem i pretty much know well how to use mySQL, thanks to this video ofc
Is there a way to display the first name of the customer in the transactions table by using the customer_id as the foreign key? Or would you have to make the first name the foreign key to display it in the table?
Great video! Any plans on covering relational databasing? That's probably the next thing that stumps a lot of people imo Also huge respect for the fundraiser, it's a great cause :)
Can we put a foreign key in a constraint. Like table_1 has column_D.O.B as primary key and table_2 has column_joining_date and joining_date should be greater than D.O.B . How do we do that?
Great lessons - as a beginner, it's short & sweet makes it easy to follow & understand. Seen other youtube lessons - difficult to follow for beginners. The comments pinned by you are very helful guide & notes. Great job, kudos to you and look forward for more.
this is great thanks. To do joins between two tables do we need to specifiy primary and foreign keys? What if you have two tables with no constraints? would it still be possible to do join queries
hello, can someone explain on how to insert an existing foreign key into two tables like inserting user_id and two tables like transaction and reserve in phpmyadmin?
Error Code: 1822. Failed to add the foreign key constraint. Missing index for constraint 'idx_product_name' in the referenced table 'products' What is this how to solve this
Hey Bro Code, Can you please please help me with creating a draw method in a tick-tak-toe game you created your-self, I really want that, and I've been trying for weeks, but I could not figure any way out. Please if you know how to create one, replay in my comment.
Pk and FK must have same data type, like INT/SMALLINT/etc are all INT, but not like INT-DECIMAL or INT-VARCHAR Then if your PK is SMALLINT (one of most common cases I guess) your FK should be: column_id INT, FOREING KEY(column_id) REFERENCES table(column_id)
maybe this will be useful for someone in future i'll drop this here. ALTER TABLE student ADD COLUMN student_loginUsername VARCHAR(35), ADD FOREIGN KEY (student_loginUsername) REFERENCES login(login_username);