Results 1 to 10 of 10
  1. #1

    Default learning (my)sql 101 - B


    [img width=500 height=266]http://i273.photobucket.com/albums/jj225/anggwaponi/sql101f.jpg[/img]

    hello mga higala ug maayong buntag .

    nia na sab ko arun mangayug maayong pang-huna2x ug magpatabang niini sa akong padayun pagkaplag ug pagkat-on mahitungod sa (my)sql .

    mangutana ko, unsa command o syntax pag-tang2x tanan anang mga "NULL"?

    ang ma-ong file gipanganlan nako my_sql_learning. so sa pag-tang2x sa mga "NULLs", mosaka ba sab ang naa sa ubos sama nga magsunod na tanan ang contents sa maong file? kana bitaw limpyuhan kay hugaw kaayo tan-awun ang mga "NULLs"

    hinaut nga maka-assist unta o maka-share kadtung maantigo ug dako ... may hataas nga kaalam sa sql .

    matsalams :mrgreen:

  2. #2

    Default Re: learning (my)sql 101 - B

    Either you delete them or don't show them by filtering.

    Delete NULLS:
    DELETE FROM my_sql_learning WHERE CustomerID IS NULL

    Filter:
    SELECT * FROM my_sql_learning WHERE CustomerID IS NOT NULL

  3. #3

    Default Re: learning (my)sql 101 - B

    I agree with cold fusion.

    You can also change the properties of your table so it will not accept NULL entries like this:

    ALTER TABLE my_sql_learning CHANGE CustomerID CustomerID int not null;

    if in case you decide to make this your primary key:

    ALTER TABLE my_sql_learning ADD primary key (CustomerID);

    I hope this helps.


  4. #4
    Junior Member
    Join Date
    May 2007
    Gender
    Male
    Posts
    322

    Default Re: learning (my)sql 101 - B

    to sort the record to desired field, just append the Order by [fieldname] [asc/desc] to the Select statement like if you want to sort the record by CustomerID you may use the query as:

    Select * From my_sql_learning Where CustomerID IS NOT NULL Order by CustomerID;

    Remember that the default order is Ascending. Just append DESC to sort it in descending order.

  5. #5

    Default Re: learning (my)sql 101 - B

    hello torade, javapenguin ug cold_fusion .

    salamat gyud kaayo sa inyong mga inputs. it loks lyk nga abilidaran na gyud diay mo tulo kabahin sa (my) sql .

    anyweiz, is it possible nga kausahon lang pag-tang2x ang word "NULL sa table"? i mean mura na emphasized man gud nga per column ang pag-tang2x lyk, " ... WHERE CustomerID ... ". so correct me if i'm wrong pero di ba per column man pag-remove lyk unahon sa CustomerID ug tingali sunod dayun ang sa CustomerName, PhoneNo, Call_Date_Time, and so on and so forth .

    please advise if same lang ba gihapon ang command o syntax if kausahon lang sa kaning table pag-tang2x ang word "NULL" .

    happy weekend sa tanan :mrgreen:.


    matsalams

  6. #6

    Default Re: learning (my)sql 101 - B

    As javapenguin's post, you could remove NULL by setting a default value to the column. This is done when creating the table or using the ALTER command.

    But it is advisable to NOT to remove the NULL because this way you could know that the column is still "untouched" or empty. A space or 0 is not the same as NULL. This is the default design and it is better that way.


  7. #7

    Default Re: learning (my)sql 101 - B

    Quote Originally Posted by cold_fusion
    As javapenguin's post, you could remove NULL by setting a default value to the column. This is done when creating the table or using the ALTER command.

    But it is advisable to NOT to remove the NULL because this way you could know that the column is still "untouched" or empty. A space or 0 is not the same as NULL. This is the default design and it is better that way
    so bai cold_fusion imo ipasabot nga as ease lang sa ang kanang mga word nga "NULL" sa table my_sql_learning arun himuon nga murag timailhan ... hmmmmmm .

    ayaw lang kalain bai cold_fusion ha ... pero mura hugaw man gud tan-awun. besides, di diay pwede o naa ba sab command o syntax nga inig-delete o remove sa mga word "NULL", mosaka (move-up) ug magtapad ang mga data sama sa usa na ka tibuok file sa table?

    actually, ang kana nga file ... table my_sql_learning, csv format ug gi-load nako sa SQL Query Analyzer nga mao ako gigamit. nagkat-on lang ko pwede ba taparun ug ipasaka ang mga data nga han-ay ug hapsay tan-awun inig kawala sa mga word "NULL" .

    by the way, daghan gyud kaayong salamat bai cold_fusion for consistently sharing sa imong expertise .

    matsalams :mrgreen:

  8. #8

    Default Re: learning (my)sql 101 - B

    The problem is that there should not be any NULL records at all in the first place.
    If you have imported this from the CSV file, it may have blank lines in between each record.

    The problem is your source file and not your database. And the symptom is the created NULLs on the db.
    Garbage IN = Garbage OUT.

  9. #9
    Junior Member
    Join Date
    May 2007
    Gender
    Male
    Posts
    322

    Default Re: learning (my)sql 101 - B

    Quote Originally Posted by anggwaponi
    so bai cold_fusion imo ipasabot nga as ease lang sa ang kanang mga word nga "NULL" sa table my_sql_learning arun himuon nga murag timailhan ... hmmmmmm .

    ayaw lang kalain bai cold_fusion ha ... pero mura hugaw man gud tan-awun. besides, di diay pwede o naa ba sab command o syntax nga inig-delete o remove sa mga word "NULL", mosaka (move-up) ug magtapad ang mga data sama sa usa na ka tibuok file sa table?

    actually, ang kana nga file ... table my_sql_learning, csv format ug gi-load nako sa SQL Query Analyzer nga mao ako gigamit. nagkat-on lang ko pwede ba taparun ug ipasaka ang mga data nga han-ay ug hapsay tan-awun inig kawala sa mga word "NULL" .

    by the way, daghan gyud kaayong salamat bai cold_fusion for consistently sharing sa imong expertise .

    matsalams :mrgreen:
    Actually if you delete the null records ang mahitabo is like what you said, mosaka na cya, nya matapad pa gyud na cya. As in mawala na ang tanan record nga null. To delete the null records you may use the SQL script provided by cold_fusion which is
    DELETE FROM my_sql_learning WHERE CustomerID IS NULL
    Ang buhaton ane once imo ni ge execute, e delete nya tanan record nga ang customerID is null. Remember nga record iya e delete, dili ang column nga imo ge ingon. Ang 'where CustomerID IS null' is filter ni cya kun unsa ang dapat e delete during script execution.

  10. #10

    Default Re: learning (my)sql 101 - B

    I think this problem could have been prevented if the table was created properly in the first place.

  11.    Advertisement

Similar Threads

 
  1. My Project 101 - Subwoofer
    By tikotakz in forum General Discussions
    Replies: 29
    Last Post: 03-10-2013, 06:56 AM
  2. SQL 101
    By BadDudes in forum Programming
    Replies: 44
    Last Post: 08-31-2012, 07:34 AM
  3. For Trade: trade my nokia 101 with your 1208 plus cash :)
    By conconn in forum Cellphones & Accessories
    Replies: 0
    Last Post: 06-25-2012, 08:15 PM
  4. learning (my)sql 101
    By anggwaponi in forum Programming
    Replies: 16
    Last Post: 02-29-2008, 01:12 PM
  5. LF: Students for PHP and My SQL programming "special courses"
    By schatz793 in forum Software & Games (Old)
    Replies: 4
    Last Post: 11-03-2007, 12:36 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
about us
We are the first Cebu Online Media.

iSTORYA.NET is Cebu's Biggest, Southern Philippines' Most Active, and the Philippines' Strongest Online Community!
follow us
#top