sabadvali sabadvali - 1 year ago 70
MySQL Question

Table row in sql as new table

I have a table with ID,Name,Date and Category.
I want Category to be also a table,with rows ID and Name.
how can I do this?

Answer Source

Hello This Is Kind OF a big Conceptual question You Should learn more about this .I am adding some ans for your question the table creation Query

   CREATE TABLE Info_table(
   ID   INT          NOT NULL,
   Date  date        NOT NULL,
   Category_ID INT references CATEGORIES(ID),
    /*Category Table */
    CREATE TABLE Category_table(
   ID   INT              NOT NULL,
   Category_NAME VARCHAR (20) NOT NULL,    
   PRIMARY KEY (ID) /*Primary Key which is used as a foreign key in the first table  */

I am also adding a sample picture related to this query see that hope It helps You RelationShip

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download