Monday, December 24, 2012

SQL සිංහලෙන් - පලමු පියවර

SQL එහෙමත් නැත්නම් Structured Query Language කියන්නෙ ඩේටාබේස් වලදි දත්ත හසුරුවන්න භාවිතා කරන විශේෂ භාෂාවක්. ඒ වගේම SQL සම්මතයක් බවට පත්වෙලයි තියෙන්නෙ. MySQL, SQL server, Oracle, Access කියන්නෙ මේ සම්මතය අනුගමනය කරන දත්ත කලමණාකරන පද්ධති (Database Management System - DBMS) කිහිපයක්.

SQL  සම්මතයක් වන නිසාම එය අනුගමනය කරන DBMS වල SELECT, UPDATE, DELETE, INSERT, WHERE වැනි විධාන වල සමානත්වයක් තියෙනව. කෙසේවෙතත් ඒ ඒ DBMS වලට අනන්‍යවූ විධානයන්ද දකින්න පුළුවන්.

MySQL කියන්නෙ SQL සම්මතය අනූව යන DBMS වලින් වඩාත්ම ජනප්‍රියම සහ බහුලවම භාවිතාවෙ පද්ධතිය. ඒකට එක හේතුවක් තමයි MySQL නිදහස් හා විවෘත්ත (Free and Open Source) ගණයට අයත්වීම.
ඒ නිසා අපි  අපේ පාඩම MySQL වලින් කරගෙන යමු.

මුදිතගෙ PHP පාඩම් වලට සම්බන්ධ වෙනව නම් මේ වෙද්දි wamp දාගෙන ඇති. වින්ඩෝස් පාවිච්චි කරන කෙනෙක් නම් මෙතනින් wamp දාගන්න විදිය කියලදෙන ඒ ලිපිය බලන්න. wamp එක්ක MySQL තියන නිසා කරදරයක් නෑ.

ලිනක්ස් පාවිච්චි කරන අයව අමතක කරල බෑ නෙ. ටර්මිනල් එක අරගෙන උබුන්ටු නම්
sudo apt-get install mysql-server
ෆෙඩෝරා නම්
yum install mysql-server
දැන් කොහොමද  MySQL රන් කරන්නෙ. wamp පාවිචිකරනව නම් පහත රූපයේ විදියට wamp අයිකනය ක්ලික් කරල එන මෙනුවෙන්  MySQL >> MySQL console තෝරන්න.

ලිනක්ස් නම් ටර්මිනල් එතට ගිහින් මේ කමාන්ඩ් එක රන් කරන්න.
mysql -uroot -proot
වැඩේ හරි නම් මේ විදියට MySQL console එක දැකගන්න පුළුවන්.
 

මේ විදියට MySQL දාගත්තනම් දැන් වැඩේ පටන්ගන්න පුළුවන්. MySQL දාගන්න විදිය බොහොම කෙටියෙන් කිව්වෙ. කරගෙන යද්දි ගැටළු ආවොත් කමෙන්ට් එකකින් හරි facebook group එකෙන් අහන්නකො.

සරල විධාන කීපයක් කරල බලමු. දැනට තියන ඩේටාබේස් මොනවද කියල බලාගන්න
show databases;
මෙම විධානය ක්‍රියාත්මක කලවිට පහත පරිදි දැනට තියන ඩේටාබේස් ලිස්ට් එකක් බලාගන්න පුළුවන්.

 මීලඟට  විධානය ක්‍රියාත්මක කලයුතු ඩේටාබේස් එක තොරාගතයුතුයි. ඒ සඳහා යොදාගන්නේ use විධානයයි. උදාහරණයක් ලෙස අපට information_schema ඩේටාබේස් එක තොරාගතයුතු නම්
 use information_schema;
 information_schema ඩේටාබේස් එක තුල ඇති tables බලාගතයුතු නම්
show tables;
 මෙවිට  information_schema ඩේටාබේස් එක තුල ඇති tables ලිස්ට් එක්ක දැකගත හැක.  information_schema ඩේටාබේස් එක තුල ඇති character_sets නැමති table එකෙහි ඇති සියළුම දත්ත ලබාගැනීමට
select * from character_sets;

මෙම සරල විධාන කිහිපය අත්හදා බලන්නග. මීලඟ ලිපි වලින් වැඩිදුර විස්තර කතාකරමු

29 comments:

  1. එල එල මචෝ... දිගටම ලියමු.

    ReplyDelete
  2. මම අද තමයි මෙකට ආවෙ.නියමයි.දිගටම ලියන්න..සුභ පතනව.

    ReplyDelete
  3. XAMP ගැනත් ලිව්වානම් හොදයි නේද ? හොද උත්සාහයක්.ජය

    ReplyDelete
    Replies
    1. ඉදිරි ලිපියකින් XAMP ගැනත් ලියන්නමිකො. ස්තූතියි අපිව දිරිමත් කරනවට. දිගටම අපිත් එක්ක ඉන්නකො

      Delete
  4. මරු ...තව දුර යන්න සුබපැතුම් !!!!!

    ReplyDelete
  5. මම සොෆ්ට්වෙයා ඉන්ජිනේරීන් ආසා කරන විශයක්. ලියන්න දිගටම කියවන්න එකතු වෙනවා.

    ReplyDelete
  6. එල එල දිගටම ලියන්න අය්යේ......
    මේ SQL පාඩම් A/L ICT කරන අයට ගොඩක් වැදගත් වෙනවා...
    ඔයාල Python ගැනත් ලිව්වනම් තවත් නියමයි............

    ReplyDelete
  7. Nicrosoft SQL server eken karana hati liyala post danna puluwannam godak loku udawwak

    ReplyDelete
  8. Tutorial is just awesome..It is really helpful for a newbie like me.. I am a regular follower of your blog. Really very informative post you shared here.

    Java training in Chennai

    Java training in Bangalore

    Java training in Hyderabad

    Java Training in Coimbatore

    Java Online Training

    ReplyDelete
  9. Nice! you are sharing such helpful and easy to understandable blog. i have no words for say i just say thanks because it is helpful for me.Very interesting to read this article.I would like to thank you for the efforts you had made for writing this awesome article.
    Data Science Training In Chennai

    Data Science Online Training In Chennai

    Data Science Training In Bangalore

    Data Science Training In Hyderabad

    Data Science Training In Coimbatore

    Data Science Training

    Data Science Online Training

    ReplyDelete
  10. Attend The Data Scientist Courses From ExcelR. Practical Data Scientist Courses Sessions With Assured Placement Support From Experienced Faculty. ExcelR Offers The Data Scientist Courses. Data Scientist Courses

    ReplyDelete
  11. Excellent post.I want to thank you for this informative read, I really appreciate sharing this great post.Keep up your work

    Data Science Training in Hyderabad

    ReplyDelete
  12. This is an excellent post I seen thanks to share it. It is really what I wanted to see hope in future you will continue for sharing such a excellent post.
    data scientist course in hyderabad

    ReplyDelete
  13. Very nice job... Thanks for sharing this amazing and educative blog post!
    data science training in malaysia

    ReplyDelete
  14. Excellent post.I want to thank you for this informative read, I really appreciate sharing this great post.Keep up your work
    data science course in malaysia

    ReplyDelete
  15. Nice blog and absolutely outstanding. You can do something much better but i still say this perfect.Keep trying for the best.
    data analytics course in hyderabad

    ReplyDelete
  16. You completed certain reliable points there. I did a search on the subject and found nearly all people will agree with your blog.
    data science course in hyderabad

    ReplyDelete
  17. You actually make it look so easy with your performance but I find this matter to be actually something which I think I would never comprehend. It seems too complicated and extremely broad for me. I'm looking forward for your next post, I’ll try to get the hang of it! data scientist course in mysore

    ReplyDelete