Unsupported Screen Size: The viewport size is too small for the theme to render properly.

Forum Replies Created

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • in reply to: What If Foreign Key Can Be Null #20190
    Luc_40
    Member

    Okay, thanks for the research. I am not so happy with the solution but i can live with it. In Oracle (i am oracle programmer / dba) i have done it already and it works fine.

    Thanks to all for the answers. This topic may be closed.

    in reply to: Same Problem On Foreign Key #20198
    Luc_40
    Member
    peterlaursen wrote on Jan 10 2006, 02:41 PM:
    Further you define genre_id SMALLINT NOT NULL PRIMARY KEY and write and i leave the field genre_id blank (it can be null).  Is not that a contracition?

    I meant the field genre_id in the table tracks, there it is said to be null allowed.

    in reply to: What If Foreign Key Can Be Null #20188
    Luc_40
    Member

    birds CREATE TABLE `birds` (

    `id` int(11) NOT NULL auto_increment,

    `father_id` int(11) default NULL,

    `mother_id` int(11) default NULL,

    `text` varchar(10) default '',

    PRIMARY KEY (`id`),

    KEY `father_id` (`father_id`),

    KEY `mother_id` (`mother_id`),

    CONSTRAINT `birds_ibfk_1` FOREIGN KEY (`father_id`) REFERENCES `birds` (`id`) ON DELETE CASCADE ON UPDATE NO ACTION,

    CONSTRAINT `birds_ibfk_2` FOREIGN KEY (`mother_id`) REFERENCES `birds` (`id`) ON DELETE CASCADE ON UPDATE NO ACTION

    ) ENGINE=InnoDB DEFAULT CHARSET=utf8

    Sorry, but it isn't working. Try the above create and then try to insert a record where you only will fill in the field text.

    in reply to: What If Foreign Key Can Be Null #20186
    Luc_40
    Member

    CalEvans, please help me as soon as you can …

    in reply to: What If Foreign Key Can Be Null #20184
    Luc_40
    Member

    A last attempt to become an answer. Next situation. I have one table 'persons' in which i put all the persons. Each person has a father. Sometimes the father is unknown. In that case i want to leave the field father_id blank. When the father is known, then the father_id has to be filled in, and the id has to reference a record in the same table persons where the sexe_cd is like 'M' (from male). When the father_id is not filled in, then it is also okay. When it is filled in with a wrong id then there has to be an error.

    Can someone tell me how to do ?

    in reply to: What If Foreign Key Can Be Null #20182
    Luc_40
    Member

    Strange, in the help, under version history, march 2003, it says 'You can make foreign key relationships within same table'. And that is exactly what i need, but i need also that this field can be null.

    in reply to: What If Foreign Key Can Be Null #20179
    Luc_40
    Member

    I want to do the following. I am a breeder of birds. I want a table TEST in which i have an id, and a field that points to the father of that bird. So it is a foreign key to the same table. Sometimes i don't know the father and then i like to leave that field empty.

    I can not solve this. Please give me an example.

    /*Column Information For – glosters.test*/


    Field Type Collation Null Key Default Extra Privileges Comment










    ID int(11) (NULL) NO PRI (NULL) auto_increment select,insert,update,references

    FATHER_ID int(11) (NULL) YES MUL (NULL) select,insert,update,references

    TEXT varchar(50) latin1_swedish_ci YES (NULL) select,insert,update,references

    /*Index Information For – glosters.test*/


    Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment













    test 0 PRIMARY 1 ID A 0 (NULL) (NULL) BTREE

    test 1 FATHER_ID 1 FATHER_ID A 0 (NULL) (NULL) YES BTREE

    /*DDL Information For – glosters.test*/


    Table Create Table



    test CREATE TABLE `test` (

    `ID` int(11) NOT NULL auto_increment,

    `FATHER_ID` int(11) default NULL,

    `TEXT` varchar(50) default NULL,

    PRIMARY KEY (`ID`),

    KEY `FATHER_ID` (`FATHER_ID`),

    CONSTRAINT `test_ibfk_1` FOREIGN KEY (`ID`) REFERENCES `test` (`FATHER_ID`)

    ) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC

    in reply to: Innodb Table Handler #20154
    Luc_40
    Member

    Sorry people, i am indeed a newbie, and i was using sql server 4.1.13. Now that i have updated to 5 it works fine. Sorry, i feel ashame …

    By the way : congratulations for the quick response, thanks

    Concerning the tiny text : the maximum length needs no more than 10 (codes and domains)

    in reply to: Innodb Table Handler #20150
    Luc_40
    Member

    strange, it keeps returning MyISAM, even when i do 'change table type to … InnoDB'

    codes CREATE TABLE `codes` (

    `ID` int(11) NOT NULL auto_increment,

    `DOMEIN` tinytext collate latin1_general_ci NOT NULL,

    `CODE` tinytext collate latin1_general_ci NOT NULL,

    `OMS_N` tinytext collate latin1_general_ci,

    `OMS_F` tinytext collate latin1_general_ci,

    `OMS_E` tinytext collate latin1_general_ci,

    `OMS_D` tinytext collate latin1_general_ci,

    PRIMARY KEY (`ID`)

    ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci ROW_FORMAT=DYNAMIC

Viewing 9 posts - 1 through 9 (of 9 total)