1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Newbie

Discussion in 'Databases' started by qim, Nov 28, 2015.

  1. #1
    Hi
    SEMrush
    I'm new to databases and have a couple of doubts

    1. I created a database with MySQL. it has a few fields but I started with an incremental numeric ID, even though I do not need it. It is a static database used only for a search facility.

    Is it necessary to have that numeric ID or can I simply get rid off it?

    2. 3 of the fields are meant to have a yes/no content. When I tried to access the database I got a "0". What do I have to do? I have them as tinyint(1), Null (yes), Default (NULL)
    Eventually, I need to write an css/html page with fields to receive the results of the search and these 3 fields will be tick boxes.
     
    qim, Nov 28, 2015 IP
    SEMrush
  2. PoPSiCLe

    PoPSiCLe Illustrious Member

    Messages:
    4,630
    Likes Received:
    725
    Best Answers:
    152
    Trophy Points:
    470
    #2
    1. Having a unique field for each row makes working with them from exteral resources easier (for changing / updating content) - instead of mathing other stuff, you just match the id-column. Keep it.
    2. You're on the right track, but a yes/no-field (boolean field, tinyint(1)) is usually used as follows: default is 0 (no) and a yes will be 1. You NEVER set no as 1. That is just... no. 0/no/off == 0, 1/yes/on == 1.
     
    PoPSiCLe, Nov 28, 2015 IP