how to see which columns are indexxed mysql 1

how to see which columns are indexxed mysql

SHOW INDEXES FROM table_name;

Here is what the above code is Doing:
1. We’re creating a table called ‘users’ with the following columns:
– id: an integer that will be the primary key for the table.
– username: a string that will be the username for the user.
– password: a string that will be the password for the user.
2. We’re creating a table called ‘tweets’ with the following columns:
– id: an integer that will be the primary key for the table.
– user_id: an integer that will be a foreign key for the users table.
– tweet: a string that will be the tweet for the user.
3. We’re creating a table called ‘follows’ with the following columns:
– id: an integer that will be the primary key for the table.
– user_id: an integer that will be a foreign key for the users table.
– follower_id: an integer that will be a foreign key for the users table.
4. We’re creating a table called ‘likes’ with the following columns:
– id: an integer that will be the primary key for the table.
– user_id: an integer that will be a foreign key for the users table.
– tweet_id: an integer that will be a foreign key for the tweets table.

Similar Posts