<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>dijexi.com &#187; database</title>
	<atom:link href="http://www.dijexi.com/tag/database/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.dijexi.com</link>
	<description>free programming tutorial, tips and tricks on php, codeigniter, delphi, dotnet, ajax and more..</description>
	<lastBuildDate>Fri, 13 Jan 2012 23:21:06 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
<atom:link rel="hub" href="http://pubsubhubbub.appspot.com"/><atom:link rel="hub" href="http://superfeedr.com/hubbub"/>		<item>
		<title>Daftar Situs Penyedia E-Book IT</title>
		<link>http://www.dijexi.com/2009/07/daftar-situs-penyedia-e-book-it/</link>
		<comments>http://www.dijexi.com/2009/07/daftar-situs-penyedia-e-book-it/#comments</comments>
		<pubDate>Fri, 17 Jul 2009 09:24:01 +0000</pubDate>
		<dc:creator>akhmad daniel sembiring</dc:creator>
				<category><![CDATA[e book]]></category>
		<category><![CDATA[E-Learning]]></category>
		<category><![CDATA[Ajax]]></category>
		<category><![CDATA[Algorithms]]></category>
		<category><![CDATA[Business & Investing]]></category>
		<category><![CDATA[C & C++]]></category>
		<category><![CDATA[Certification Stuff]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[Delphi]]></category>
		<category><![CDATA[Development for Web]]></category>
		<category><![CDATA[Dot NET]]></category>
		<category><![CDATA[download]]></category>
		<category><![CDATA[General Programming]]></category>
		<category><![CDATA[Graphics & Design]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[Magazines]]></category>
		<category><![CDATA[Medical & Health]]></category>
		<category><![CDATA[Networks]]></category>
		<category><![CDATA[Operating System]]></category>
		<category><![CDATA[Perl]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Science & Engineering]]></category>
		<category><![CDATA[Scripts & Web Templates]]></category>
		<category><![CDATA[Software Development]]></category>
		<category><![CDATA[UML]]></category>
		<category><![CDATA[Video Training]]></category>
		<category><![CDATA[XML]]></category>

		<guid isPermaLink="false">http://www.dijexi.com/2009/07/daftar-situs-penyedia-e-book-it/</guid>
		<description><![CDATA[Image by Andrei Z via Flickr Berikut ini daftar beberapa situs yang menyediakan e-book seputar IT yang bisa didownload gratis. List ini senantiasa diupdate, jadi sebaiknya di-bookmark siapa tau perlu di kemudian hari. Jika anda punya situs e-book yang baik silahkan hubungi kami di halaman Contact. &#160; www.Flazx.com Menyediakan e-book dengan kategori sbb : Artificial [...]]]></description>
			<content:encoded><![CDATA[<!--INFOLINKS_ON--><div style="margin: 1em; width: 58px; display: block; float: right; height: 68px" class="zemanta-img" jquery1247822554937="703"><a href="http://www.flickr.com/photos/70561184@N00/460647338"><img style="border-bottom: medium none; border-left: medium none; display: block; border-top: medium none; border-right: medium none" alt="Mind boggling" src="http://farm1.static.flickr.com/178/460647338_eec5c06ec5_m.jpg" width="41" height="36" /></a>
<p style="font-size: 0.8em" class="zemanta-img-attribution">Image by <a href="http://www.flickr.com/photos/70561184@N00/460647338">Andrei Z</a> via Flickr</p>
</p></div>
<p>Berikut ini daftar beberapa situs yang menyediakan e-book seputar IT yang bisa didownload gratis. List ini senantiasa diupdate, jadi sebaiknya di-bookmark siapa tau perlu di kemudian hari. Jika anda punya situs e-book yang baik silahkan hubungi kami di halaman Contact.</p>
<p>&#160;</p>
<p> <span id="more-825"></span><br />
<h2><a href="http://www.flazx.com/" target="_blank">www.Flazx.com</a></h2>
<p>Menyediakan e-book dengan kategori sbb : <a class="zem_slink" title="Artificial intelligence" href="http://en.wikipedia.org/wiki/Artificial_intelligence" rel="wikipedia">Artificial Intelligence</a>, Certification, Computer Application, <a class="zem_slink" title="Computer engineering" href="http://en.wikipedia.org/wiki/Computer_engineering" rel="wikipedia">Computer Engineering</a>, Computer Hardware, Computer Science, Computer Security, Databases, Design &amp; Graphics, Electronic Commerce, Information Systems, Miscellaneous, Mobile Computing, Multimedia, Networks, Operating System, Programming, <a class="zem_slink" title="Software engineering" href="http://en.wikipedia.org/wiki/Software_engineering" rel="wikipedia">Software Engineering</a>, Telecommunication, Web </p>
<h2><a href="http://www.free-itebooks.com/" target="_blank">Free-ITebooks.com</a></h2>
<p>Menyediakan e-book dengan kategori:Artificial Intelligence, Database, dotNET, Electronic, Flash, Hacking Related, Java, Javascript, Linux, Unix, BSD, <a class="zem_slink" title="BeOS" href="http://www.beincorporated.com/" rel="homepage">BeOS</a> etc, Network &amp; Network Programming, Office Related, Other Open Source, Python, Robotics &amp; Automation, SEO, System Administration, Web &amp; Web Design Related, Links, Other Free Programming Ebooks, </p>
<h2><a href="http://corebook.blogspot.com/" target="_blank">Corebook Online Library</a> </h2>
<p>Menyediakan e-book dengan kategori:Ajax, ASP.NET , <a class="zem_slink" title="AutoCAD" href="http://www.autodesk.com/autocad" rel="homepage">AutoCAD</a> , C and C++ , C# , Delphi , Flex , Java , Javascript , MS Office , <a class="zem_slink" title="MySQL" href="http://www.mysql.com/" rel="homepage">MySQL</a> , Oracle , Photoshop , <a class="zem_slink" title="PHP" href="http://php.net/" rel="homepage">PHP</a>, SAP, Visual Basic.Net</p>
<p align="left"><script language="javascript"><!--//
var server_client_id = 1672;
var server_ad_width = 468;  
var server_ad_height = 60;
var server_ad_style = "468x60_as";
var server_code_version = "4";
var server_ad_color_border = "111111";
var server_ad_color_background = "CCCCCC";
var server_ad_color_headline = "7E8AA2";
var server_ad_color_body = "000000";
var server_ad_color_url = "666EBA";
var server_ad_keyword = "";  
var server_ad_channel = 1;
var server_publisher_channels = "";
var server_ad_random = 1;</p>
<p>//--></script><script type="text/javascript" src="http://www.adsklix.com/ads/display_ads.php">
</script></p>
<h2><a href="http://getebook.co.cc/" target="_blank">Getebook.co.cc</a></h2>
<p>Menyediakan e-book dengan kategori: Databases, Game, Graphic &amp; Design, <a class="zem_slink" title="Internet" href="http://en.wikipedia.org/wiki/Internet" rel="wikipedia">Internet</a>, Networking, Office, Operating Systems, Programming, Web Development, Other </p>
<h2><a href="http://www.netbks.com/" target="_blank">Download Free Computer Ebooks &#8211; NET BOOKS</a> </h2>
<p>Menyediakan e-book dengan kategori: Game Mini, Comics, Architecture, Business &amp; Investing, Medical &amp; Health, Science &amp; Engineering, Scripts &amp; Web Templates, Ajax, Algorithms, C &amp; C++, Certification Stuff, Database, Delphi, Development for Web, Dot NET, General Programming, Graphics &amp; Design, Java, <a class="zem_slink" title="JavaScript" href="http://en.wikipedia.org/wiki/JavaScript" rel="wikipedia">JavaScript</a>, Magazines, Networks, Operating System, Perl, PHP, Python, Software Development, UML, Video Training, XML </p>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:7ded3f6e-eb52-41be-ad5c-3c394debf115" class="wlWriterEditableSmartContent">Technorati Tags: <a href="http://technorati.com/tags/e-book" rel="tag">e-book</a>,<a href="http://technorati.com/tags/download" rel="tag">download</a>,<a href="http://technorati.com/tags/Business+%26+Investing" rel="tag">Business &amp; Investing</a>,<a href="http://technorati.com/tags/Medical+%26+Health" rel="tag">Medical &amp; Health</a>,<a href="http://technorati.com/tags/Science+%26+Engineering" rel="tag">Science &amp; Engineering</a>,<a href="http://technorati.com/tags/Scripts+%26+Web+Templates" rel="tag">Scripts &amp; Web Templates</a>,<a href="http://technorati.com/tags/Ajax" rel="tag">Ajax</a>,<a href="http://technorati.com/tags/Algorithms" rel="tag">Algorithms</a>,<a href="http://technorati.com/tags/C+%26+C%2b%2b" rel="tag">C &amp; C++</a>,<a href="http://technorati.com/tags/Certification+Stuff" rel="tag">Certification Stuff</a>,<a href="http://technorati.com/tags/Database" rel="tag">Database</a>,<a href="http://technorati.com/tags/Delphi" rel="tag">Delphi</a>,<a href="http://technorati.com/tags/Development+for+Web" rel="tag">Development for Web</a>,<a href="http://technorati.com/tags/Dot+NET" rel="tag">Dot NET</a>,<a href="http://technorati.com/tags/General+Programming" rel="tag">General Programming</a>,<a href="http://technorati.com/tags/Graphics+%26+Design" rel="tag">Graphics &amp; Design</a>,<a href="http://technorati.com/tags/Java" rel="tag">Java</a>,<a href="http://technorati.com/tags/JavaScript" rel="tag">JavaScript</a>,<a href="http://technorati.com/tags/Magazines" rel="tag">Magazines</a>,<a href="http://technorati.com/tags/Networks" rel="tag">Networks</a>,<a href="http://technorati.com/tags/Operating+System" rel="tag">Operating System</a>,<a href="http://technorati.com/tags/Perl" rel="tag">Perl</a>,<a href="http://technorati.com/tags/PHP" rel="tag">PHP</a>,<a href="http://technorati.com/tags/Python" rel="tag">Python</a>,<a href="http://technorati.com/tags/Software+Development" rel="tag">Software Development</a>,<a href="http://technorati.com/tags/UML" rel="tag">UML</a>,<a href="http://technorati.com/tags/Video+Training" rel="tag">Video Training</a>,<a href="http://technorati.com/tags/XML" rel="tag">XML</a></div>
<p>&#160;</p>
<p>More to come, stay tuned…</p>
<p>&#160;</p>
</p>
</p>
</p>
</p>
</p>
</p>
<div class="zemanta-related">
<h6 style="font-size: 1em" class="zemanta-related-title">Related articles by Zemanta</h6>
<ul class="zemanta-article-ul">
<li class="zemanta-article-ul-li"><a href="http://www.ooad.org/">Object Oriented Analysis and Design </a>(ooad.org) </li>
<li class="zemanta-article-ul-li"><a href="http://oreilly.com/catalog/9780596157135/">Learning PHP, MySQL, and JavaScript </a>(oreilly.com) </li>
<li class="zemanta-article-ul-li"><a href="http://www.noupe.com/php/php-security-tips.html">PHP Security: Fortifying Your Website- Power Tips, Tools &amp; How to&#8217;s </a>(noupe.com) </li>
<li class="zemanta-article-ul-li"><a href="http://www.slideshare.net/hjyang27/introkoreaitindustrypromotionagency">Introduction for Korea It Industry Promotion Agency </a>(slideshare.net) </li>
</ul></div>
</p>
</p>
</p>
<div style="margin-top: 10px; height: 15px" class="zemanta-pixie"><a class="zemanta-pixie-a" title="Reblog this post [with Zemanta]" href="http://reblog.zemanta.com/zemified/e7ecb3b1-4d0c-4672-8546-0fb313c61293/"><img style="border-bottom-style: none; border-right-style: none; border-top-style: none; float: right; border-left-style: none" class="zemanta-pixie-img" alt="Reblog this post [with Zemanta]" src="http://img.zemanta.com/reblog_e.png?x-id=e7ecb3b1-4d0c-4672-8546-0fb313c61293" /></a></div>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://www.dijexi.com/2009/06/joomla-1-5-mengganti-judul-welcome-to-the-frontpage/" rel="bookmark">Joomla 1.5: Mengganti Judul Welcome to the Frontpage</a></li><li><a href="http://www.dijexi.com/2009/04/bagaimana-cara-setup-paypal-modul-di-zen-cart-tm/" rel="bookmark">Bagaimana Cara Setup PayPal Modul di Zen Cart (tm)</a></li><li><a href="http://www.dijexi.com/2009/09/publishing-secrets-part-1-how-to-produce-e-books-on-the-fly/" rel="bookmark">Publishing Secrets, Part 1: How to Produce E-Books On the Fly</a></li><li><a href="http://www.dijexi.com/2009/09/why-upload-com-is-the-best-e-book-website-for-publishing-e-books-free-of-charge/" rel="bookmark">Why Upload.com Is the Best E-Book Website For Publishing E-Books Free of Charge</a></li><li><a href="http://www.dijexi.com/2010/02/funambol-mobile-open-source-book-released/" rel="bookmark">Funambol Mobile Open Source Book Released</a></li></ul></div><!--INFOLINKS_OFF--><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fwww.dijexi.com%2F2009%2F07%2Fdaftar-situs-penyedia-e-book-it%2F&amp;linkname=Daftar%20Situs%20Penyedia%20E-Book%20IT"><img src="http://www.dijexi.com/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://www.dijexi.com/2009/07/daftar-situs-penyedia-e-book-it/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Menguasai Structured Query Language (SQL)</title>
		<link>http://www.dijexi.com/2009/07/menguasai-structured-query-language-sql/</link>
		<comments>http://www.dijexi.com/2009/07/menguasai-structured-query-language-sql/#comments</comments>
		<pubDate>Mon, 06 Jul 2009 03:21:33 +0000</pubDate>
		<dc:creator>akhmad daniel sembiring</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[sql command]]></category>
		<category><![CDATA[sql statements]]></category>

		<guid isPermaLink="false">http://www.dijexi.com/2009/07/menguasai-structured-query-language-sql/</guid>
		<description><![CDATA[Image by lilit via Flickr Database, tabel, baris, dan kolom Dalam konteks bahasa SQL, pada umumnya informasi tersimpan dalam tabel-tabel yang secara logik merupakan struktur 2 dimensi yang terdiri dari baris-baris data (row atau record) yang berada dalam satu atau lebih kolom (column). Baris pada tabel sering disebut sebagai instance dari data sedangkan kolom sering [...]]]></description>
			<content:encoded><![CDATA[<!--INFOLINKS_ON--><div class="zemanta-img" style="margin: 1em; width: 250px; display: block; float: right;"><a href="http://www.flickr.com/photos/29492436@N00/63853597"><img style="border-bottom: medium none; border-left: medium none; display: block; border-top: medium none; border-right: medium none" src="http://farm1.static.flickr.com/28/63853597_80e3a3566c_m.jpg" alt="(My)SQL geek" width="240" height="180" /></a></p>
<p class="zemanta-img-attribution" style="font-size: 0.8em">Image by <a href="http://www.flickr.com/photos/29492436@N00/63853597">lilit</a> via Flickr</p>
</div>
<h2><a name="_Toc466784032">Database, tabel, baris, dan kolom</a></h2>
<p>Dalam konteks bahasa <a class="zem_slink" title="SQL" rel="wikipedia" href="http://en.wikipedia.org/wiki/SQL">SQL</a>, pada umumnya informasi tersimpan dalam tabel-tabel yang secara logik merupakan struktur 2 dimensi yang terdiri dari baris-baris data (row atau record) yang berada dalam satu atau lebih kolom (column). Baris pada tabel sering disebut sebagai instance dari data sedangkan kolom sering disebut sebagai attributes atau field.<span id="more-561"></span></p>
<p>Keseluruhan tabel-tabel itu dihimpun dalam satu kesatuan yang disebut database.</p>
<p><a href="http://www.dijexi.com/wp-content/uploads/2009/07/clip_image002.gif"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Gambar 1 Database, tabel, kolom, dan baris" src="http://www.dijexi.com/wp-content/uploads/2009/07/clip_image002_thumb.gif" border="0" alt="Gambar 1 Database, tabel, kolom, dan baris" width="500" height="262" /></a></p>
<p>Gambar 1 Database, tabel, kolom, dan baris</p>
<p><!--more--></p>
<h2><a name="_Toc466784033">Type data pada MySQL</a></h2>
<p>Berikut ini tabel <a class="zem_slink" title="Data type" rel="wikipedia" href="http://en.wikipedia.org/wiki/Data_type">data type</a> yang dapat digunakan untuk field-field tabel pada database MySQL.</p>
<p>Tabel 1 Type <a class="zem_slink" title="Data field" rel="wikipedia" href="http://en.wikipedia.org/wiki/Data_field">data field</a> pada MySQL</p>
<table border="1" cellspacing="0" cellpadding="0" width="500">
<tbody>
<tr>
<td width="170" valign="top"><strong>Name</strong></td>
<td width="232" valign="top"><strong>Keterangan</strong></td>
<td width="96" valign="top"><strong>Ukuran</strong></td>
</tr>
<tr>
<td width="170" valign="top">TINYINT[(M)] [UNSIGNED] [ZEROFILL]</td>
<td width="232" valign="top">Signed range -128 – 127</p>
<p>Unsigned range 0 &#8211; 255.</td>
<td width="96" valign="top">1</td>
</tr>
<tr>
<td width="170" valign="top">SMALLINT[(M)]. [UNSIGNED] [ZEROFILL]</td>
<td width="232" valign="top">Signed range -32768 – 32767</p>
<p>Unsigned range 0 &#8211; 65535.</td>
<td width="96" valign="top">2</td>
</tr>
<tr>
<td width="170" valign="top">MEDIUMINT[(M)] [UNSIGNED] [ZEROFILL]</td>
<td width="232" valign="top">Signed range -8388608-8388607</p>
<p>Unsigned range 0 &#8211; 16777215.</td>
<td width="96" valign="top">3</td>
</tr>
<tr>
<td width="170" valign="top">INT[(M)] [UNSIGNED] [ZEROFILL]</td>
<td width="232" valign="top">Signed range -2147483648 – 2147483647</p>
<p>Unsigned range 0 &#8211; 4294967295.</td>
<td width="96" valign="top">4</td>
</tr>
<tr>
<td width="170" valign="top">BIGINT[(M)] [UNSIGNED] [ZEROFILL]</td>
<td width="232" valign="top">Signed range -9223372036854775808 – 9223372036854775807</p>
<p>Unsigned Range 0 &#8211; 18446744073709551615.</td>
<td width="96" valign="top">8</td>
</tr>
<tr>
<td width="170" valign="top">FLOAT(Precision)</td>
<td width="232" valign="top">Angka <a class="zem_slink" title="Floating point" rel="wikipedia" href="http://en.wikipedia.org/wiki/Floating_point">floating point</a>. Presisi boleh 4 atau 8. FLOAT(4) adalah <a class="zem_slink" title="Single precision" rel="wikipedia" href="http://en.wikipedia.org/wiki/Single_precision">single precision</a> dan FLOAT(8) adalah <a class="zem_slink" title="Double precision" rel="wikipedia" href="http://en.wikipedia.org/wiki/Double_precision">double precision</a> (lihat juga DOUBLE).</p>
<p>Range -3.402823466E+38F &#8211; -1.175494351E-38, 0, -1.175494351E-38 &#8211; 3.402823466E+38F.</td>
<td width="96" valign="top">4</td>
</tr>
<tr>
<td width="170" valign="top">FLOAT[(M,D)]</td>
<td width="232" valign="top">Angka floating point kecil. Tidak boleh unsigned.</p>
<p>Range -3.402823466E+38F &#8211; -1.175494351E-38, 0, -1.175494351E-38 &#8211; 3.402823466E+38F.</td>
<td width="96" valign="top">4</td>
</tr>
<tr>
<td width="170" valign="top">DOUBLE PRECISION[(M,D)]</td>
<td width="232" valign="top">Angka floating point normal. Tidak boleh unsigned.</p>
<p>Range -1.7976931348623157E+308 &#8211; -2.2250738585072014E-308, 0, 2.2250738585072014E-308 &#8211; 1.7976931348623157E+308.</td>
<td width="96" valign="top">8</td>
</tr>
<tr>
<td width="170" valign="top">REAL[(M,D)]</td>
<td width="232" valign="top">Sama seperti DOUBLE</td>
<td width="96" valign="top">8</td>
</tr>
<tr>
<td width="170" valign="top">DECIMAL [(M,D)]</td>
<td width="232" valign="top">Angka unpacked floating point. Tidak boleh unsigned. Range sama seperti DOUBLE.</p>
<p>Berkelakuan seperti CHAR</td>
<td width="96" valign="top">M+D</td>
</tr>
<tr>
<td width="170" valign="top">NUMERIC [(M,D)]</td>
<td width="232" valign="top">Sama seperti DECIMAL</td>
<td width="96" valign="top">M+D</td>
</tr>
<tr>
<td width="170" valign="top">TIMESTAMP [(M)]</td>
<td width="232" valign="top">Timestamp otomatis. Berisi waktu pada saat tabel diakses, dalam <a class="zem_slink" title="Unix time" rel="wikipedia" href="http://en.wikipedia.org/wiki/Unix_time">UNIX time</a>.</td>
<td width="96" valign="top">4</td>
</tr>
<tr>
<td width="170" valign="top">DATE</td>
<td width="232" valign="top">Untuk menyimpan informasi tanggal.</p>
<p>Format : &#8216;YY-MM-DD&#8217;, &#8216;<a class="zem_slink" title="ISO 8601" rel="wikipedia" href="http://en.wikipedia.org/wiki/ISO_8601">YYYY-MM-DD</a>&#8216;, dan &#8216;YYMMDD&#8217;.</p>
<p>Range 0000-00-00 to 9999-12-31.</td>
<td width="96" valign="top">4</td>
</tr>
<tr>
<td width="170" valign="top">TIME</td>
<td width="232" valign="top">Untuk menyimpan informasi waktu</p>
<p>Format : &#8216;HH:MM:SS, &#8216;HHMMSS&#8217;, &#8216;HHMM&#8217;, &#8216;HH&#8217;.</td>
<td width="96" valign="top">3</td>
</tr>
<tr>
<td width="170" valign="top">DATETIME</td>
<td width="232" valign="top">Untuk menyimpan informasi tanggal dan waktu.</p>
<p>Format &#8220;YYYY-MM-DD HH:MM:SS&#8221;.</p>
<p>Range &#8217;0000-01-01 00:00:00&#8242; &#8211; &#8217;9999-12-31 23:59:59&#8242;.</td>
<td width="96" valign="top">8</td>
</tr>
<tr>
<td width="170" valign="top">CHAR(M) [binary]</td>
<td width="232" valign="top">String dengan panjang tetap, selalu tersimpan sesuai dengan panjang yang ditentukan.</p>
<p>Range 1 &#8211; 255 characters.</p>
<p>Seluruh space akhiran dibuang saat di-retriev.</p>
<p>Di-sortir dan dibandingkan secara case insensitive kecuali jika diberikan binary keyword.</td>
<td width="96" valign="top">M</td>
</tr>
<tr>
<td width="170" valign="top">VARCHAR(M) [binary]</td>
<td width="232" valign="top">String dengan panjang variabel, tersimpan sesuai dengan panjangnya saat itu.</p>
<p>Range 1 &#8211; 255 characters.</p>
<p>Seluruh space akhiran dibuang saat di-retriev.</p>
<p>Di-sortir dan dibandingkan secara case insensitive kecuali jika diberikan binary keyword.</td>
<td width="96" valign="top">L+1</td>
</tr>
<tr>
<td width="170" valign="top">TINYTEXT and TINYBLOB</td>
<td width="232" valign="top">TEXT/BLOB dengan panjang maksimum 255 karakter.</td>
<td width="96" valign="top">L+1</td>
</tr>
<tr>
<td width="170" valign="top">TEXT and BLOB</td>
<td width="232" valign="top">TEXT/BLOB dengan panjang maksimum 65535 karakter.</td>
<td width="96" valign="top">L+2</td>
</tr>
<tr>
<td width="170" valign="top">MEDIUMTEXT and MEDIUMBLOB</td>
<td width="232" valign="top">TEXT/BLOB dengan panjang maksimum 16777216 karakter.</td>
<td width="96" valign="top">L+3</td>
</tr>
<tr>
<td width="170" valign="top">LONGTEXT and LONGBLOB</td>
<td width="232" valign="top">TEXT/BLOB dengan panjang maksimum 4294967295 karakter.</td>
<td width="96" valign="top">L+4</td>
</tr>
<tr>
<td width="170" valign="top">ENUM(&#8216;value&#8217;,'value2&#8242;,&#8230;)</td>
<td width="232" valign="top">Objeck string yang hanya boleh memiliki satu nilai dari nilai yang dimungkinkan (atau NULL).</td>
<td width="96" valign="top">1 or 2</td>
</tr>
<tr>
<td width="170" valign="top">SET(&#8216;value&#8217;,'value2&#8242;,&#8230;)</td>
<td width="232" valign="top">Objeck string yang boleh memiliki lebih dari satu nilai dari nilai yang dimungkinkan (atau NULL).</td>
<td width="96" valign="top">1-8</td>
</tr>
</tbody>
</table>
<h2><a name="_Toc466784034">Membuat database</a></h2>
<p>Pada modul ini kita akan membuat database dengan nama <strong>shopping</strong> yang terdiri dari tabel-tabel:</p>
<ul>
<li><strong>publishers</strong> , berisi daftar nama penerbit buku</li>
<li><strong>titles</strong>, berisi daftar judul buku</li>
</ul>
<p>Gunakan perintah di bawah ini untuk membuat database pada MySQL server.</p>
<pre style="border: 1px solid #cecece; padding: 5px; overflow: auto; background-color: #fbfbfb; min-height: 40px; width: 500px;">
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"># mysqladmin create &lt;nama-database&gt;</pre>
</pre>
<p>Contohnya</p>
<pre style="border: 1px solid #cecece; padding: 5px; overflow: auto; background-color: #fbfbfb; min-height: 40px; width: 500px;">
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"># mysqladmin create shopping</pre>
</pre>
<p>Database &#8220;shopping&#8221; created.</p>
<h2><a name="_Toc466784035">Membuat tabel</a></h2>
<p>Setelah database terbuat, anda harus membuat tabel yang akan menyimpan data yang anda butuhkan. Sebagai contoh kita akan membuat tabel daftar penerbit buku (<strong>publishers</strong>). Tabel ini berisi field-field sebagai berikut:</p>
<p>Tabel 2 Struktur tabel publishers</p>
<table border="1" cellspacing="0" cellpadding="0" width="500">
<tbody>
<tr>
<td width="116" valign="top"><strong>Field</strong></td>
<td width="90" valign="top"><strong>Type</strong></td>
<td width="102" valign="top"><strong>Panjang</strong></td>
<td width="190" valign="top"><strong>Keterangan</strong></td>
</tr>
<tr>
<td width="116" valign="top">pub_id</td>
<td width="90" valign="top">char</td>
<td width="102" valign="top">3</td>
<td width="190" valign="top">berisi nomor identifikasi penerbit, primary key tabel ini</td>
</tr>
<tr>
<td width="116" valign="top">pub_name</td>
<td width="90" valign="top">char</td>
<td width="102" valign="top">20</td>
<td width="190" valign="top">berisi nama penerbit</td>
</tr>
<tr>
<td width="116" valign="top">city</td>
<td width="90" valign="top">char</td>
<td width="102" valign="top">10</td>
<td width="190" valign="top">berisi nama kota tempat penerbit berada</td>
</tr>
<tr>
<td width="116" valign="top">state</td>
<td width="97" valign="top">char</td>
<td width="118" valign="top">10</td>
<td width="250" valign="top">nama provinsi tempat penerbit berada</td>
</tr>
</tbody>
</table>
<p>Gunakan perintah <strong>mysql</strong> &lt;nama-database&gt; untuk membuat tabel yang dimaksud di atas.</p>
<pre style="border: 1px solid #cecece; padding: 5px; overflow: auto; background-color: #fbfbfb; min-height: 40px; width: 500px;">
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"># mysql shopping</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">Welcome to the MySQL monitor. Commands end with ; or \g.</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">Your MySQL connection id is 403 to server version: 3.22.10-beta</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">Type 'help' <span style="color: #0000ff">for</span> help.</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">mysql&gt;</pre>
</pre>
<p>Prompt mysql&gt; merupakan tempat anda memasukkan perintah-perintah MySQL yang akan kita pelajari sebentar lagi. Setiap perintah SQL pada MySQL harus diakhiri dengan tanda titik-koma (;). Untuk keluar dari prompt mysql&gt; gunakan perintah <strong>quit</strong>.</p>
<p>Pada prompt mysql ketikkan perintah-perintah untuk membuat tabel <strong>publishers</strong>, sebagai berikut</p>
<pre style="border: 1px solid #cecece; padding: 5px; overflow: auto; background-color: #fbfbfb; min-height: 40px; width: 500px;">
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">mysql&gt; create table publishers (</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">-&gt; pub_id <span style="color: #0000ff">int</span>,</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">-&gt; pub_name <span style="color: #0000ff">char</span>(20),</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">-&gt; city <span style="color: #0000ff">char</span>(10),</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">-&gt; state <span style="color: #0000ff">char</span>(10)</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">-&gt; );</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">Query OK, 0 rows affected (0.06 sec)</pre>
</pre>
<p>Setelah itu, pada database shopping akan terdapat tabel <strong>publishers</strong> yang belum terisi data.</p>
<h2><a name="_Toc466784036">Latihan</a></h2>
<p>Buat tabel – tabel di bawah ini pada database shopping.</p>
<p>Tabel 3 Struktur tabel authors</p>
<table border="1" cellspacing="0" cellpadding="0" width="500">
<tbody>
<tr>
<td width="110" valign="top"><strong>Field</strong></td>
<td width="96" valign="top"><strong>Type</strong></td>
<td width="102" valign="top"><strong>Panjang</strong></td>
<td width="190" valign="top"><strong>Keterangan</strong></td>
</tr>
<tr>
<td width="110" valign="top">au_id</td>
<td width="96" valign="top">integer</td>
<td width="102" valign="top"></td>
<td width="190" valign="top">Nomor identifikasi penulis buku</td>
</tr>
<tr>
<td width="110" valign="top">au_fname</td>
<td width="96" valign="top">char</td>
<td width="102" valign="top">20</td>
<td width="190" valign="top">First name penulis</td>
</tr>
<tr>
<td width="110" valign="top">au_lname</td>
<td width="96" valign="top">char</td>
<td width="102" valign="top">20</td>
<td width="190" valign="top">Last Name penulis</td>
</tr>
<tr>
<td width="110" valign="top">city</td>
<td width="96" valign="top">char</td>
<td width="102" valign="top">10</td>
<td width="190" valign="top">Berisi nama kota tempat penerbit berada</td>
</tr>
<tr>
<td width="110" valign="top">state</td>
<td width="102" valign="top">char</td>
<td width="117" valign="top">10</td>
<td width="249" valign="top">Nama provinsi tempat penerbit berada</td>
</tr>
</tbody>
</table>
<p>Tabel 4 Struktur tabel titles</p>
<table border="1" cellspacing="0" cellpadding="0" width="499">
<tbody>
<tr>
<td width="108" valign="top"><strong>Field</strong></td>
<td width="96" valign="top"><strong>Type</strong></td>
<td width="102" valign="top"><strong>Panjang</strong></td>
<td width="191" valign="top"><strong>Keterangan</strong></td>
</tr>
<tr>
<td width="108" valign="top">title_id</td>
<td width="96" valign="top">char</td>
<td width="102" valign="top">6</td>
<td width="191" valign="top">Identifikasi judul buku, primary key</td>
</tr>
<tr>
<td width="108" valign="top">title</td>
<td width="96" valign="top">char</td>
<td width="102" valign="top">80</td>
<td width="191" valign="top">Judul buku</td>
</tr>
<tr>
<td width="108" valign="top">type</td>
<td width="96" valign="top">char</td>
<td width="102" valign="top">15</td>
<td width="191" valign="top">Jenis kategori buku</td>
</tr>
<tr>
<td width="108" valign="top">pub_id</td>
<td width="96" valign="top">char</td>
<td width="102" valign="top">3</td>
<td width="191" valign="top">Identifikasi penerbit, foreign key ke tabel publishers</td>
</tr>
<tr>
<td width="108" valign="top">price</td>
<td width="96" valign="top">integer</td>
<td width="102" valign="top"></td>
<td width="191" valign="top">Harga judul buku ini</td>
</tr>
<tr>
<td width="108" valign="top">advance</td>
<td width="96" valign="top">integer</td>
<td width="102" valign="top"></td>
<td width="191" valign="top"></td>
</tr>
<tr>
<td width="108" valign="top">royalty</td>
<td width="96" valign="top">integer</td>
<td width="102" valign="top"></td>
<td width="191" valign="top">Royalti</td>
</tr>
<tr>
<td width="108" valign="top">ytd_sales</td>
<td width="96" valign="top">integer</td>
<td width="102" valign="top"></td>
<td width="191" valign="top"></td>
</tr>
<tr>
<td width="108" valign="top">notes</td>
<td width="96" valign="top">char</td>
<td width="102" valign="top">200</td>
<td width="191" valign="top">Catatan tentang judul ini</td>
</tr>
<tr>
<td width="108" valign="top">pubdate</td>
<td width="103" valign="top">int</td>
<td width="117" valign="top"></td>
<td width="250" valign="top">Tahun penerbitan</td>
</tr>
</tbody>
</table>
<h2><a name="_Toc466784037">Insert Query</a></h2>
<p>Untuk mengisi data pada suatu tabel, gunakan perintah SQL INSERT. Syntaksnya adalah:</p>
<p>INSERT INTO nama-tabel (kolom1,kolom2, …) VALUES (nilai1, nilai2, …);</p>
<p>Contohnya jika anda ingin mengisi tabel <strong>publishers</strong> dengan data sebagai berikut:</p>
<ul>
<li>Nomor kode; 1</li>
<li>Nama penerbit: Gramedia</li>
<li>Kota : Jakarta</li>
<li>State: Indonesia</li>
</ul>
<p>Maka perintah SQL INSERT yang harus anda ketikkan adalah sebagai berikut:</p>
<pre style="border: 1px solid #cecece; padding: 5px; overflow: auto; background-color: #fbfbfb; min-height: 40px; width: 500px;">
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">mysql&gt; INSERT INTO publishers (pub_id, pub_name, city, state)</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">-&gt; VALUES</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">-&gt; (1, ‘Gramedia’, ‘Jakarta’, ‘Indonesia’);</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">Query OK, 1 row affected (0.01 sec)</pre>
</pre>
<p>Selain melalui prompt mysql, anda dapat juga mengisi data pada database melalui file yang telah berisi data, tentunya dalam format syntaks SQL yang benar. Contohnya, buat file dengan nama PUBLISHER.SQL dengan ini sebagai berikut:</p>
<pre style="border: 1px solid #cecece; padding: 5px; overflow: auto; background-color: #fbfbfb; min-height: 40px; width: 500px;">
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">INSERT INTO publishers VALUES ('100','Addison-Wesley','MA','USA');</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">INSERT INTO publishers VALUES ('101','BANTAM BOOK','MA','USA');</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">INSERT INTO publishers VALUES ('102','Harper Business','MA','USA');</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">INSERT INTO publishers VALUES ('103','Hewlett Packard','MA','USA');</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">INSERT INTO publishers VALUES ('104','John Wiley &amp; Sons, Inc','MA','USA');</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">INSERT INTO publishers VALUES ('105','Macmillan Publishing Company','MA','USA');</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">INSERT INTO publishers VALUES ('106','McGraw Hill','MA','USA');</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">INSERT INTO publishers VALUES ('107','O\'Reilly &amp; Associates, inc','MA','USA');</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">INSERT INTO publishers VALUES ('108','Osborne McGraw-Hill','MA','USA');</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">INSERT INTO publishers VALUES ('109','Prentice Hall','MA','USA');</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">INSERT INTO publishers VALUES ('110','Sams','MA','USA');</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">INSERT INTO publishers VALUES ('111','Wiley','MA','USA');</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">INSERT INTO publishers VALUES ('112','Microsoft','MA','USA');</pre>
</pre>
<p>Lalu , dari prompt Linux, ketikkan perintah:</p>
<pre style="border: 1px solid #cecece; padding: 5px; overflow: auto; background-color: #fbfbfb; min-height: 40px; width: 500px;">
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"># mysql shopping &lt; PUBLISHERS.SQL</pre>
</pre>
<p>Perhatikan bahwa pada sintaks INSERT, untuk semua field yang bertype char, data yang dimasukkan harus diapit oleh tanda petik ‘’, sedangkan untuk type integer tidak.</p>
<h3><a name="_Toc466784038">Latihan</a></h3>
<ul>
<li>Isikan data pada tabel <strong>authors</strong> dan <strong>titles</strong> dengan file AUTHORS.SQL dan TITLES.SQL yang dapat anda download dari alamat <a href="ftp://instruktur.wahid.com/pub/Training/linux-ecommerce">sini</a>.</li>
</ul>
<h2><a name="_Toc466784039">Menggunakan Query SELECT</a></h2>
<p>Perintah SELECT digunakan untuk melihat data dari satu atau beberapa tabel. Syntasknya secara sederhana adalah:</p>
<blockquote><p>SELECT kolom-kolom</p>
<p>FROM nama-tabel</p></blockquote>
<h3>Menampilkan kolom tertentu</h3>
<p>Misalnya, untuk melihat nama-nama pengarang buku yang terdapat pada tabel authors, dapat anda gunakan perintah:</p>
<pre style="border: 1px solid #cecece; padding: 5px; overflow: auto; background-color: #fbfbfb; min-height: 40px; width: 500px;">
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">SELECT au_lname, au_fname</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">FROM authors</pre>
</pre>
<p>Hasilnya akan terlihat daftar nama yang tediri dari dua kolom , masing-masing au_lname dan au_fname, seperti berikut ini:</p>
<pre style="border: 1px solid #cecece; padding: 5px; overflow: auto; background-color: #fbfbfb; min-height: 40px; width: 500px;">
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">+------------+----------+</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| au_lname   | au_fname |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">+------------+----------+</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| Purbo      | Onno     |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| Daniel     | Akhmad   |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| Arif       | Aulia    |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| Nursasono  | Rudi     |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">+------------+----------+</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">8 rows in set (0.00 sec)</pre>
</pre>
<h3>Ekspression pada query</h3>
<p>Tampilan kolom hasil query dapat kita modifikasi sehingga mengeluarkan informasi yang kita butuhkan. Misalnya untuk menampilkan harga discount dari harga normal pada tabel title, anda dapat menggunakan:</p>
<pre style="border: 1px solid #cecece; padding: 5px; overflow: auto; background-color: #fbfbfb; min-height: 40px; width: 500px;">
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">SELECT title_id, type, price , price * 0.1</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">FROM titles</pre>
</pre>
<p>Hasilnya adalah kolom-kolom nomor buku, jenis buku, harga, dan harga discount yang merupakan perkalian harga dengan 0.1.</p>
<pre style="border: 1px solid #cecece; padding: 5px; overflow: auto; background-color: #fbfbfb; min-height: 40px; width: 500px;">
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">+----------+----------------------+-------+-------------+</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| title_id | type                 | price | price * .1  |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">+----------+----------------------+-------+-------------+</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">...</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| PR2807   | PROGRAMMING          | 4     | 0.4         |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| IN7709   | INTERNET             | 65    | 6.5         |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| UN6462   | UNIX                 | 18    | 1.8         |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| CO0175   | COMMUNICATION        | 97    | 9.7         |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| IN2467   | INTERNET             | 28    | 2.8         |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| IN9823   | INTERNET             | 49    | 4.9         |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| IN8724   | INTERNET             | 62    | 6.2         |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| MA5142   | MARKETING            | 64    | 6.4         |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| UN9539   | UNIX                 | 35    | 3.5         |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| IN9247   | INTERNET             | 83    | 8.3         |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| UN1623   | UNIX                 | 10    | 1.0         |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| NE5367   | NETWORKING           | 2     | 0.2         |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| UN2956   | UNIX                 | 77    | 7.7         |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| MA8688   | MARKETING            | 80    | 8.0         |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| IN3551   | INFOSYS              | 71    | 7.1         |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| UN9725   | UNIX                 | 13    | 1.3         |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| PR6948   | PROGRAMMING          | 55    | 5.5         |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">+----------+----------------------+-------+-------------+</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">174 rows in set (0.02 sec)</pre>
</pre>
<h3>Distinct</h3>
<p>Keyword DISTINCT dapat anda gunakan untuk menghilangkan record-record yang duplikasi. Misalnya jalankan query berikut ini.</p>
<pre style="border: 1px solid #cecece; padding: 5px; overflow: auto; background-color: #fbfbfb; min-height: 40px; width: 500px;">
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">SELECT type FROM titles</pre>
</pre>
<p>Hasilnya</p>
<pre style="border: 1px solid #cecece; padding: 5px; overflow: auto; background-color: #fbfbfb; min-height: 40px; width: 500px;">
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">+----------------------+</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| type                 |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">+----------------------+</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">...</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| INTERNET             |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| MARKETING            |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| UNIX                 |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| INTERNET             |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| UNIX                 |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| NETWORKING           |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| UNIX                 |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| MARKETING            |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| INFOSYS              |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| UNIX                 |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| PROGRAMMING          |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">+----------------------+</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">174 rows in set (0.02 sec)</pre>
</pre>
<p>Pada contoh di atas, jika ingin menampilkan kolom type yang tidak duplikasi, maka perintah querynya adalah sebagai berikut</p>
<pre style="border: 1px solid #cecece; padding: 5px; overflow: auto; background-color: #fbfbfb; min-height: 40px; width: 500px;">
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">SELECT DISTINCT type FROM titles</pre>
</pre>
<p>dan hasilnya adalah sebagai berikut</p>
<pre style="border: 1px solid #cecece; padding: 5px; overflow: auto; background-color: #fbfbfb; min-height: 40px; width: 500px;">
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">+----------------------+</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| type |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">+----------------------+</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">...</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| DATABASE |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| ELECTRONICS |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| ENVIRONMENT |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| FINANCE |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| INFOSYS |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| INTERNET |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| INVESTMENT |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| MANAGEMENT |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| MARKETING |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| MISC |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| NETWORKING |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| PROGRAMMING |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| QUALITY ASSURANCE |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| SOFTWARE |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| UNIX |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| USER'S MANUAL |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">+----------------------+</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">18 rows in set (0.02 sec)</pre>
</pre>
<p>Jika ada lebih dari satu kolom, maka keyword DISTINCT hanya akan menghilangkan record yang seluruh kolomnya sama.</p>
<h3>SELECT *</h3>
<p>Untuk melihat seluruh isi kolom dari suatu tabel anda dapat menggunakan query SELECT *. Contohnya :</p>
<pre style="border: 1px solid #cecece; padding: 5px; overflow: auto; background-color: #fbfbfb; min-height: 40px; width: 500px;">
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">SELECT * FROM authors</pre>
</pre>
<p>Hasilnya adalah</p>
<pre style="border: 1px solid #cecece; padding: 5px; overflow: auto; background-color: #fbfbfb; min-height: 40px; width: 500px;">
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">+-------+------------+----------+----------+-----------+</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| au_id | au_lname   | au_fname | city     | state     |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">+-------+------------+----------+----------+-----------+</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| 1     | White      | Johnson  | US       | CA        |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| 2     | Purbo      | Onno     | Bandung  | Indonesia |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| 3     | Daniel     | Akhmad   | Bandung  | Indonesia |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| 4     | Zamfarra   | Zilmy    | Bandung  | Indonesia |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| 5     | Arif       | Aulia    | Bandung  | Indonesia |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| 5     | Suhardiman | Basuki   | Surabaya | Indonesia |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| 6     | Straight   | Dean     | MA       | USA       |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| 7     | Nursasono  | Rudi     | Jakarta  | Indonesia |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">+-------+------------+----------+----------+-----------+</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">8 rows in set (0.04 sec)</pre>
</pre>
<h3><a name="_Toc466784040">Mem-filter hasil query dengan where</a></h3>
<p>Anda dapat membatasi hasil query dengan keyword WHERE sehingga record-record yang dikeluarkan hanyalah record yang sesuai dengan kriteria yang anda inginkan. Misalnya jika anda ingin menampilkan seluruh judul buku yang berharga di bawah 10, maka querynya adalah</p>
<pre style="border: 1px solid #cecece; padding: 5px; overflow: auto; background-color: #fbfbfb; min-height: 40px; width: 500px;">
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">SELECT title, price</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">FROM titles</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">WHERE price &lt; 3</pre>
</pre>
<p>Hasilnya adalah</p>
<pre style="border: 1px solid #cecece; padding: 5px; overflow: auto; background-color: #fbfbfb; min-height: 40px; width: 500px;">
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">+----------------------------------------------------+-------+</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| title                                              | price |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">+----------------------------------------------------+-------+</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| CPU 16                                             | 1     |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| Understanding DCE                                  | 1     |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| 15th Arrl andTapr Digital Communications Conferenc | 2     |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| TCP/IP Netwrok Administrator                       | 2     |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">+----------------------------------------------------+-------+</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">4 rows in set (0.01 sec)</pre>
</pre>
<h3><a name="_Toc466784041">Equality dan inequality</a></h3>
<p>Pada contoh sebelumnya kita melihat sebuah operator &lt; yang digunakan untuk membandingkan apakah operand sebelah kiri lebih kecil daripada operand sebelah kanan. Pada SQL, terdapat operator equality dan inequality lain yaitu:</p>
<p>Tabel 5 Operator equality dan inequality</p>
<table border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td width="114" valign="top"><strong>Operator</strong></td>
<td width="336" valign="top"><strong>Guna</strong></td>
</tr>
<tr>
<td width="114" valign="top">=</td>
<td width="336" valign="top">operand kiri sama dengan operand kanan</td>
</tr>
<tr>
<td width="114" valign="top">&lt;&gt; atau !=</td>
<td width="336" valign="top">operand kiri tidak sama dengan operand kanan</td>
</tr>
<tr>
<td width="114" valign="top">&gt;=</td>
<td width="336" valign="top">operand kiri lebih besar atau sama dengan operand kanan</td>
</tr>
<tr>
<td width="114" valign="top">&lt;=</td>
<td width="336" valign="top">operand kiri lebih kecil atau sama dengan operand kanan</td>
</tr>
</tbody>
</table>
<h3><a name="_Toc466784042">Operator logic AND dan OR</a></h3>
<p>Operator ini digunakan untuk menggabungkan dua atau lebih kondisi. Misalnya untuk melihat buku yang berjenis “Database” harganya kurang dari $3 , dapat anda gunakan query berikut ini</p>
<pre style="border: 1px solid #cecece; padding: 5px; overflow: auto; background-color: #fbfbfb; min-height: 40px; width: 500px;">
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">SELECT title, type, price</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">FROM titles</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">WHERE type = ‘DATABASE’ AND price &lt; 50</pre>
</pre>
<p>Hasilnya adalah</p>
<pre style="border: 1px solid #cecece; padding: 5px; overflow: auto; background-color: #fbfbfb; min-height: 40px; width: 500px;">
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">+---------------------------+-------+</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| title                     | price |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">+---------------------------+-------+</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| Oracle PL/SQL Programming | 42    |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| Database Developer        | 8     |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">+---------------------------+-------+</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">2 rows in set (0.01 sec)</pre>
</pre>
<h3><a name="_Toc466784043">Between</a></h3>
<p>Keyword BETWEEN dapat anda gunakan untuk membatasi suatu kolom berada pada suatu batas nilai tertentu. Misalnya untuk mencari buku yang harganya berkisar antara $2 hingga $5, dapat anda gunakan query:</p>
<pre style="border: 1px solid #cecece; padding: 5px; overflow: auto; background-color: #fbfbfb; min-height: 40px; width: 500px;">
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">SELECT title, price, type</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">FROM titles</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">WHERE price BETWEEN 30 AND 100</pre>
</pre>
<p>Hasilnya</p>
<pre style="border: 1px solid #cecece; padding: 5px; overflow: auto; background-color: #fbfbfb; min-height: 40px; width: 500px;">
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">+---------------------------+-------+----------+</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| title                     | price | type     |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">+---------------------------+-------+----------+</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| Oracle PL/SQL Programming | 42    | DATABASE |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| Oracle PL/SQL Programming | 62    | DATABASE |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| Oracle Performance Tuning | 83    | DATABASE |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">+---------------------------+-------+----------+</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">3 rows in set (0.01 sec)</pre>
</pre>
<h3><a name="_Toc466784044">Like</a></h3>
<p>Keyword LIKE digunakan u ntuk mencari data yang memiliki pola tertentu. Misalnya untuk mencari buku yang judulnya mengandung kata UNIX, dapat anda gunakan query;</p>
<pre style="border: 1px solid #cecece; padding: 5px; overflow: auto; background-color: #fbfbfb; min-height: 40px; width: 500px;">
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">SELECT title, price</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">FROM titles</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">WHERE title LIKE ‘%windows%’</pre>
</pre>
<p>Hasilnya adalah</p>
<pre style="border: 1px solid #cecece; padding: 5px; overflow: auto; background-color: #fbfbfb; min-height: 40px; width: 500px;">
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">+---------------------------------+-------+</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| title                           | price |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">+---------------------------------+-------+</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| Connectic Quick Cam <span style="color: #0000ff">for</span> Windows | 25    |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| Borland Delphi <span style="color: #0000ff">for</span> Windows      | 55    |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">+---------------------------------+-------+</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">2 rows in set (0.01 sec)</pre>
</pre>
<p>Pada keyword LIKE dapat anda gunakan tanda-tanda khusus (wildcard) sebagai berikut ini:</p>
<p>Tabel 6 Wildcard pada keyword LIKE</p>
<table border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td width="72" valign="top"><strong>Tanda</strong></td>
<td width="282" valign="top"><strong>Arti</strong></td>
</tr>
<tr>
<td width="72" valign="top">%</td>
<td width="282" valign="top">Sembarang nol atau lebih karakter</td>
</tr>
<tr>
<td width="72" valign="top">_</td>
<td width="282" valign="top">Sembarang satu karaker</td>
</tr>
<tr>
<td width="72" valign="top">[ ]</td>
<td width="282" valign="top">Sembarang karakter yang berada dalam tanda kurung siku</td>
</tr>
</tbody>
</table>
<p>Misalnya untuk mencari judul buku yang berawalan dengan huruf A, maka digunakan query</p>
<pre style="border: 1px solid #cecece; padding: 5px; overflow: auto; background-color: #fbfbfb; min-height: 40px; width: 500px;">
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">SELECT title FROM titles</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">WHERE title LIKE ‘A%’</pre>
</pre>
<p>Untuk mencari judul buku yang memiliki kode BU1234, BI1234, dan BW1234, maka digunakan query</p>
<pre style="border: 1px solid #cecece; padding: 5px; overflow: auto; background-color: #fbfbfb; min-height: 40px; width: 500px;">
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">SELECT title FROM titles</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">WHERE title like ‘B[UIW]1234’</pre>
</pre>
<h3><a name="_Toc466784045">Men-sortir data</a></h3>
<p>Hasil query dapat anda sortir sesuai dengan kebutuhan anda dengan keyword ORDER BY. Misalnya untuk menampilkan daftar judul buku sesuai dengan urutan abjad, gunakan query</p>
<pre style="border: 1px solid #cecece; padding: 5px; overflow: auto; background-color: #fbfbfb; min-height: 40px; width: 500px;">
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">SELECT title, price</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">FROM titles</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">ORDER BY title</pre>
</pre>
<p>Untuk men-sortir dengan urutan terbalik, gunakan keyowrd tambahan DESC, seperti ini</p>
<pre style="border: 1px solid #cecece; padding: 5px; overflow: auto; background-color: #fbfbfb; min-height: 40px; width: 500px;">
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">SELECT title, price</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">FROM titles</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">ORDER BY title DESC</pre>
</pre>
<p>Anda dapat mensortir lebih dari satu kolom , misalnya query berikut ini</p>
<pre style="border: 1px solid #cecece; padding: 5px; overflow: auto; background-color: #fbfbfb; min-height: 40px; width: 500px;">
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">SELECT title, price</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">FROM titles</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">ORDER BY title, price</pre>
</pre>
<p>akan menghasilkan tampilan daftar buku yang terurut berdasarkan abjad dan harganya.</p>
<h3><a name="_Toc466784046">Agregate Function</a></h3>
<p>Selain dari pengolahan record-record, SQL juga menyediakan fungsi-fungsi yang dapat digunakan untuk menghitung hasil tampilan. Fungsi-fungsi itu adalah seperti berikut ini.</p>
<p>Tabel 7 Fungsi-fungsi agregate</p>
<table border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td width="108" valign="top"><strong>Nama Fungsi</strong></td>
<td width="282" valign="top"><strong>Guna</strong></td>
</tr>
<tr>
<td width="108" valign="top">sum()</td>
<td width="282" valign="top">menghitung jumlah ekspesi numerik</td>
</tr>
<tr>
<td width="108" valign="top">avg()</td>
<td width="282" valign="top">menghiting rata-rata ekspesi numerik</td>
</tr>
<tr>
<td width="108" valign="top">min()</td>
<td width="282" valign="top">menghitung angka minimal ekspesi numerik</td>
</tr>
<tr>
<td width="108" valign="top">max()</td>
<td width="282" valign="top">menghitung angka maksimal ekspesi numerik</td>
</tr>
<tr>
<td width="108" valign="top">count()</td>
<td width="282" valign="top">menghitung jumlah non-null ekspesi</td>
</tr>
<tr>
<td width="108" valign="top">count(*)</td>
<td width="282" valign="top">menghitung jumlah baris</td>
</tr>
</tbody>
</table>
<p>Misalnya untuk mengetahui harga rata-rata dari buku yang ada di daftar yang anda miliki, gunakan query</p>
<pre style="border: 1px solid #cecece; padding: 5px; overflow: auto; background-color: #fbfbfb; min-height: 40px; width: 500px;">
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">SELECT avg(price)</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">FROM titles</pre>
</pre>
<p>Hasilnya</p>
<pre style="border: 1px solid #cecece; padding: 5px; overflow: auto; background-color: #fbfbfb; min-height: 40px; width: 500px;">
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">+------------+</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| avg(price) |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">+------------+</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| 49.1149    |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">+------------+</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">1 row in set (0.00 sec)</pre>
</pre>
<p>Untuk mengetahui jumlah buku yang ada pada daftar, dapat anda gunakan query</p>
<pre style="border: 1px solid #cecece; padding: 5px; overflow: auto; background-color: #fbfbfb; min-height: 40px; width: 500px;">
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">SELECT count(*)</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">FROM titles</pre>
</pre>
<p>Hasilnya</p>
<pre style="border: 1px solid #cecece; padding: 5px; overflow: auto; background-color: #fbfbfb; min-height: 40px; width: 500px;">
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">+----------+</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| count(*) |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">+----------+</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| 174      |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">+----------+</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">1 row in set (0.00 sec)</pre>
</pre>
<h3><a name="_Toc466784047">Sub agregate dengan Group By</a></h3>
<p>Fungsi count(*) dapat digunakan untuk mengetahui jumlah seluruh buku yang anda miliki. Untuk mengetahui jumlah buku dan harga rata-rata setiap jenis buku, anda harus menggunakan GROUP BY yang dikombinasikan dengan sum() dan avg() seperti berikut ini.</p>
<pre style="border: 1px solid #cecece; padding: 5px; overflow: auto; background-color: #fbfbfb; min-height: 40px; width: 500px;">
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">SELECT type, AVG(price) , SUM(price)</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">FROM titles</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">GROUP BY type</pre>
</pre>
<p>Hasilnya</p>
<pre style="border: 1px solid #cecece; padding: 5px; overflow: auto; background-color: #fbfbfb; min-height: 40px; width: 500px;">
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">+----------------------+------------+------------+</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| type                 | avg(price) | sum(price) |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">+----------------------+------------+------------+</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| COMMUNICATION        | 76.8000    | 384        |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| COMPUTER ENGINEERING | 28.6667    | 86         |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| DATABASE             | 48.7500    | 195        |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| ELECTRONICS          | 50.6667    | 608        |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| ENVIRONMENT          | 41.3636    | 455        |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| FINANCE              | 51.0000    | 357        |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| INFOSYS              | 57.5455    | 633        |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| INTERNET             | 55.5556    | 1000       |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| INVESTMENT           | 41.5000    | 166        |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| MANAGEMENT           | 73.5000    | 147        |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| MARKETING            | 60.6667    | 182        |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| MISC                 | 38.3333    | 115        |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| NETWORKING           | 15.5000    | 31         |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| PROGRAMMING          | 47.7727    | 1051       |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| QUALITY ASSURANCE    | 80.0000    | 80         |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| SOFTWARE             | 37.1429    | 260        |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| UNIX                 | 45.5849    | 2416       |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| USER'S MANUAL        | 63.3333    | 380        |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">+----------------------+------------+------------+</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">18 rows in set (0.02 sec)</pre>
</pre>
<h3><a name="_Toc466784048">Mem-filter hasil agregate function</a></h3>
<p>Untuk mem-filter tampilan setelah dilakukan fungsi agregate, digunakan keyword HAVING. Misalnya untuk menampilkan jenis kategori yang harga rata-ratanya di atas $60, digunakan query</p>
<pre style="border: 1px solid #cecece; padding: 5px; overflow: auto; background-color: #fbfbfb; min-height: 40px; width: 500px;">
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">SELECT type, AVG(price)</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">FROM titles</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">GROUP BY type</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">HAVING AVG(price)&gt;60</pre>
</pre>
<p>Hasilnya</p>
<pre style="border: 1px solid #cecece; padding: 5px; overflow: auto; background-color: #fbfbfb; min-height: 40px; width: 500px;">
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">+-------------------+------------+</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| type              | avg(price) |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">+-------------------+------------+</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| COMMUNICATION     | 76.8000    |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| MANAGEMENT        | 73.5000    |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| MARKETING         | 60.6667    |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| QUALITY ASSURANCE | 80.0000    |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| USER'S MANUAL     | 63.3333    |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">+-------------------+------------+</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">5 rows in set (0.02 sec)</pre>
</pre>
<p>Bandingkan jika anda menggunakan query</p>
<pre style="border: 1px solid #cecece; padding: 5px; overflow: auto; background-color: #fbfbfb; min-height: 40px; width: 500px;">
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">SELECT type, AVG(price)</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">FROM titles</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">WHERE price &gt; 60</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">GROUP BY type</pre>
</pre>
<p>dimana proses filtering terjadi sebelum dirata-ratakan, artinya yang dirata-ratakan adalah buku yang memiliki harga di atas $60, maka hasilnya adalah</p>
<pre style="border: 1px solid #cecece; padding: 5px; overflow: auto; background-color: #fbfbfb; min-height: 40px; width: 500px;">
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">+-------------------+------------+</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| type              | avg(price) |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">+-------------------+------------+</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| COMMUNICATION     | 76.8000    |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| DATABASE          | 72.5000    |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| ELECTRONICS       | 74.2000    |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| ENVIRONMENT       | 78.0000    |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| FINANCE           | 78.0000    |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| INFOSYS           | 76.5000    |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| INTERNET          | 75.1111    |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| INVESTMENT        | 84.0000    |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| MANAGEMENT        | 73.5000    |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| MARKETING         | 72.0000    |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| MISC              | 63.0000    |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| PROGRAMMING       | 74.0000    |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| QUALITY ASSURANCE | 80.0000    |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| UNIX              | 79.8421    |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| USER'S MANUAL     | 77.2500    |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">+-------------------+------------+</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">15 rows in set (0.02 sec)</pre>
</pre>
<h3><a name="_Toc466784049">Join</a></h3>
<p>Pada contoh-contoh sebelumnya kita hanya menggunakan sat tabel pada satu saat. Umumnya aplikasi dengan SQL server melakukan query dengan menggunakan lebih dari satu tabel pada satu saat.</p>
<p>Sekarang kita akan mencoba untuk melakukan query dengan tabel <strong>publishers</strong> digabungkan dengan tabel <strong>titles</strong>, dimana kita akan menampilkan daftar buku dan penerbitnya dalam satu query. Untuk hal ini kita memerlukan informasi baik dari tabel <strong>titles</strong> maupun tabel <strong>publishers</strong>. Proses penggabungan lebih dari satu tabel ini disebut <em>join</em>, sedangkan hubungan keduanya disebut <em>relation</em>.</p>
<p>Untuk melakukan join, tabel-tabel itu harus memiliki <em>common key </em>atau <em>join key </em>yang menentukan bagaimana baris-baris antar kedua tabel tersebut saling berhubungan. Contohnya pada tabel <strong>publishers</strong> dan <strong>titles</strong>, kedua tabel ini saling berbagi <em>common key</em> yang bernama <strong>pub_id</strong>. Pada tabel <strong>publishers</strong>, <strong>pub_id</strong> secara unik mengindetifikasi suatu baris pada tabel itu. Pada tabel <strong>titles</strong>, suatu nilai <strong>pub_id</strong> secara unik mengidentifikasi suatu baris pada tabel <strong>publishers</strong>. Ini berarti bahwa judul buku dengan <strong>pub_id</strong> ini diterbitkan oleh penerbit yang tercantum pada baris yang ditunjukkan oleh <strong>pub_id</strong> pada tabel <strong>publishers</strong>.</p>
<p>Secara diagram, hubungan kedua tabel tersebut dapat digambarkan sebagai berikut:</p>
<p><a href="http://www.dijexi.com/wp-content/uploads/2009/07/clip_image0041.gif"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Gambar 2 Relasi tabel publishers dan titles" src="http://www.dijexi.com/wp-content/uploads/2009/07/clip_image004_thumb1.gif" border="0" alt="Gambar 2 Relasi tabel publishers dan titles" width="500" height="275" /></a></p>
<p>Gambar 2 Relasi tabel publishers dan titles</p>
<p>Saat menggabung dua tabel, SQL server tidak langsung mengerti hubungan antar dua tabel tersebut. Artinya anda harus menuliskan <em>common key </em>yang digunakan dalam penggabungan ini. Contohnya, untuk menampilkan daftar buku dan penerbitnya dari tabel <strong>titles </strong>dan <strong>publishers</strong>, dapat anda gunakan query berikut ini.</p>
<pre style="border: 1px solid #cecece; padding: 5px; overflow: auto; background-color: #fbfbfb; min-height: 40px; width: 500px;">
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">SELECT title, pub_name</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">FROM titles, publishers</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">WHERE titles.pub_id = publishers.pub_id</pre>
</pre>
<p>Hasilnya adalah sebagai berikut:</p>
<pre style="border: 1px solid #cecece; padding: 5px; overflow: auto; background-color: #fbfbfb; min-height: 40px; width: 500px;">
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">+----------------------------------------------------+----------------+</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| title                                              | pub_name       |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">+----------------------------------------------------+----------------+</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">...</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| PSD                                                | Prentice Hall  |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| The Java Solution Guide                            | Prentice Hall  |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| 13th Arrl Digital Communications Conference        | Prentice Hall  |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| 15th Arrl and Tapr Digital Communications Conferen | Prentice Hall  |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| Unix Networking Programming                        | Sams           |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| Termcap &amp; terminfo                                 | Sams           |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| Using C on the Unix System                         | Sams           |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| SCO in a Nitshell                                  | Sams           |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| Radio Communication                                | Sams           |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| The Programming Language                           | Sams           |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| Z80 Apllication                                    | Sams           |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| The New IEEE Standard Dictionary of Electrical and | Sams           |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| Wireless Digital Communicators Design and Theory   | Sams           |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| Building A Sucessful Software Business             | Sams           |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| Mathcad 4.0                                        | Sams           |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">| 15th Arrl andTapr Digital Communications Conferenc | Sams           |</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">+----------------------------------------------------+----------------+</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">174 rows in set (0.03 sec)</pre>
</pre>
<p>Jika anda lupa untuk mencantumkan <em>common key</em> pada join, anda akan mendapatkan hasil yang sangat banyak yang merupakan daftar yang berisi iterasi judul buku untuk setiap baris penerbit.</p>
<h3><a name="_Toc466784050">Menghapus record dengan Delele Query</a></h3>
<p>Untuk menghapus suatu record dengan kriteria tertentu, gunakan query berikut ini</p>
<pre style="border: 1px solid #cecece; padding: 5px; overflow: auto; background-color: #fbfbfb; min-height: 40px; width: 500px;">
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">DELETE FROM nama-tabel WHERE kriteria</pre>
</pre>
<p>Misalnya jika anda hendak menghapus record judul buku pada tabel <strong>titles</strong> yang memiliki harga di bawah $20, gunakan query berikut ini:</p>
<pre style="border: 1px solid #cecece; padding: 5px; overflow: auto; background-color: #fbfbfb; min-height: 40px; width: 500px;">
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"><a style="color: #0000ff" href="http://search.microsoft.com/default.asp?so=RECCNT&amp;siteid=us%2Fdev&amp;p=1&amp;nq=NEW&amp;qu=DELETE&amp;IntlSearch=&amp;boolean=PHRASE&amp;ig=01&amp;i=09&amp;i=99">DELETE</a> <a style="color: #0000ff" href="http://search.microsoft.com/default.asp?so=RECCNT&amp;siteid=us%2Fdev&amp;p=1&amp;nq=NEW&amp;qu=FROM&amp;IntlSearch=&amp;boolean=PHRASE&amp;ig=01&amp;i=09&amp;i=99">FROM</a> titles <a style="color: #0000ff" href="http://search.microsoft.com/default.asp?so=RECCNT&amp;siteid=us%2Fdev&amp;p=1&amp;nq=NEW&amp;qu=WHERE&amp;IntlSearch=&amp;boolean=PHRASE&amp;ig=01&amp;i=09&amp;i=99">WHERE</a> price &lt; 20</pre>
</pre>
<p>Untuk medelete seluruh record pada suatu tabel, gunakan perintah DELETE tanpa menentukan kriterianya, seperti :</p>
<pre style="border: 1px solid #cecece; padding: 5px; overflow: auto; background-color: #fbfbfb; min-height: 40px; width: 500px;">
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"><a style="color: #0000ff" href="http://search.microsoft.com/default.asp?so=RECCNT&amp;siteid=us%2Fdev&amp;p=1&amp;nq=NEW&amp;qu=DELETE&amp;IntlSearch=&amp;boolean=PHRASE&amp;ig=01&amp;i=09&amp;i=99">DELETE</a> <a style="color: #0000ff" href="http://search.microsoft.com/default.asp?so=RECCNT&amp;siteid=us%2Fdev&amp;p=1&amp;nq=NEW&amp;qu=FROM&amp;IntlSearch=&amp;boolean=PHRASE&amp;ig=01&amp;i=09&amp;i=99">FROM</a> nama-<a style="color: #0000ff" href="http://search.microsoft.com/default.asp?so=RECCNT&amp;siteid=us%2Fdev&amp;p=1&amp;nq=NEW&amp;qu=table&amp;IntlSearch=&amp;boolean=PHRASE&amp;ig=01&amp;i=09&amp;i=99">table</a></pre>
</pre>
<h3><a name="_Toc466784051">Modifikasi record dengan Update query</a></h3>
<p>Untuk memodifikasi nilai kolom dari suatu record, gunakan query UPDATE seperti berikut ini.</p>
<pre style="border: 1px solid #cecece; padding: 5px; overflow: auto; background-color: #fbfbfb; min-height: 40px; width: 500px;">
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"><a style="color: #0000ff" href="http://search.microsoft.com/default.asp?so=RECCNT&amp;siteid=us%2Fdev&amp;p=1&amp;nq=NEW&amp;qu=UPDATE&amp;IntlSearch=&amp;boolean=PHRASE&amp;ig=01&amp;i=09&amp;i=99">UPDATE</a> nama-tabel</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"><a style="color: #0000ff" href="http://search.microsoft.com/default.asp?so=RECCNT&amp;siteid=us%2Fdev&amp;p=1&amp;nq=NEW&amp;qu=SET&amp;IntlSearch=&amp;boolean=PHRASE&amp;ig=01&amp;i=09&amp;i=99">SET</a> nama-kolom1=nilai-baru1, nama-kolom2=nilai-baru2,...</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"><a style="color: #0000ff" href="http://search.microsoft.com/default.asp?so=RECCNT&amp;siteid=us%2Fdev&amp;p=1&amp;nq=NEW&amp;qu=WHERE&amp;IntlSearch=&amp;boolean=PHRASE&amp;ig=01&amp;i=09&amp;i=99">WHERE</a> kriteria</pre>
</pre>
<p>Contohnya jika anda hendak memodifikasi nilai harga buku menjadi 50% untuk buku yang harganya masih berada di bawah $20, gunakan query</p>
<pre style="border: 1px solid #cecece; padding: 5px; overflow: auto; background-color: #fbfbfb; min-height: 40px; width: 500px;">
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"><a style="color: #0000ff" href="http://search.microsoft.com/default.asp?so=RECCNT&amp;siteid=us%2Fdev&amp;p=1&amp;nq=NEW&amp;qu=UPDATE&amp;IntlSearch=&amp;boolean=PHRASE&amp;ig=01&amp;i=09&amp;i=99">UPDATE</a> titles</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"><a style="color: #0000ff" href="http://search.microsoft.com/default.asp?so=RECCNT&amp;siteid=us%2Fdev&amp;p=1&amp;nq=NEW&amp;qu=SET&amp;IntlSearch=&amp;boolean=PHRASE&amp;ig=01&amp;i=09&amp;i=99">SET</a> price=price * 1.5</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"><a style="color: #0000ff" href="http://search.microsoft.com/default.asp?so=RECCNT&amp;siteid=us%2Fdev&amp;p=1&amp;nq=NEW&amp;qu=WHERE&amp;IntlSearch=&amp;boolean=PHRASE&amp;ig=01&amp;i=09&amp;i=99">WHERE</a> price &lt; 20</pre>
</pre>
<p>Untuk memodifikasi nilai suatu kolom secara keseluruhan, gunakan query UPDATE tanpa kriteria, misalnya</p>
<pre style="border: 1px solid #cecece; padding: 5px; overflow: auto; background-color: #fbfbfb; min-height: 40px; width: 500px;">
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"><a style="color: #0000ff" href="http://search.microsoft.com/default.asp?so=RECCNT&amp;siteid=us%2Fdev&amp;p=1&amp;nq=NEW&amp;qu=UPDATE&amp;IntlSearch=&amp;boolean=PHRASE&amp;ig=01&amp;i=09&amp;i=99">UPDATE</a> titles</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"><a style="color: #0000ff" href="http://search.microsoft.com/default.asp?so=RECCNT&amp;siteid=us%2Fdev&amp;p=1&amp;nq=NEW&amp;qu=SET&amp;IntlSearch=&amp;boolean=PHRASE&amp;ig=01&amp;i=09&amp;i=99">SET</a> price=100</pre>
</pre>
<p>Query ini akan meneybabkan seluruh harga buku pada tabel <strong>titles</strong> menjadi $100.</p>
<h3><a name="_Toc466784052">Menambah record dengan INSERT</a></h3>
<p>Untuk menambah record pada suatu tabel, gunakan query INSERT berikut ini</p>
<pre style="border: 1px solid #cecece; padding: 5px; overflow: auto; background-color: #fbfbfb; min-height: 40px; width: 500px;">
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"><a style="color: #0000ff" href="http://search.microsoft.com/default.asp?so=RECCNT&amp;siteid=us%2Fdev&amp;p=1&amp;nq=NEW&amp;qu=INSERT&amp;IntlSearch=&amp;boolean=PHRASE&amp;ig=01&amp;i=09&amp;i=99">INSERT</a> <a style="color: #0000ff" href="http://search.microsoft.com/default.asp?so=RECCNT&amp;siteid=us%2Fdev&amp;p=1&amp;nq=NEW&amp;qu=INTO&amp;IntlSearch=&amp;boolean=PHRASE&amp;ig=01&amp;i=09&amp;i=99">INTO</a> nama-tabel</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">(kolom1, kolom2, ... kolomn)</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"><a style="color: #0000ff" href="http://search.microsoft.com/default.asp?so=RECCNT&amp;siteid=us%2Fdev&amp;p=1&amp;nq=NEW&amp;qu=VALUES&amp;IntlSearch=&amp;boolean=PHRASE&amp;ig=01&amp;i=09&amp;i=99">VALUES</a> (nilai1, nilai2, ... nilain)</pre>
</pre>
<p>Misalnya untuk menambahkan data berikut ini</p>
<ul>
<li>Nomor Indentifikasi Buku PE0034</li>
<li>Judul Buku &#8220;Visual C++ 5.0, The Complete Refference&#8221;</li>
<li>Jenis Buku &#8220;PEMROGRAMAN&#8221;</li>
<li>Penerbit Osborne (kode 102)</li>
</ul>
<p>Maka pada tabel <strong>titles</strong>, gunakan query berikut ini:</p>
<pre style="border: 1px solid #cecece; padding: 5px; overflow: auto; background-color: #fbfbfb; min-height: 40px; width: 500px;">
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"><a style="color: #0000ff" href="http://search.microsoft.com/default.asp?so=RECCNT&amp;siteid=us%2Fdev&amp;p=1&amp;nq=NEW&amp;qu=INSERT&amp;IntlSearch=&amp;boolean=PHRASE&amp;ig=01&amp;i=09&amp;i=99">INSERT</a> <a style="color: #0000ff" href="http://search.microsoft.com/default.asp?so=RECCNT&amp;siteid=us%2Fdev&amp;p=1&amp;nq=NEW&amp;qu=INTO&amp;IntlSearch=&amp;boolean=PHRASE&amp;ig=01&amp;i=09&amp;i=99">INTO</a> titles</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">(title_id, title, type, pub_id, price, advance, royalty, ytd_sales, notes, pubdate)</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"><a style="color: #0000ff" href="http://search.microsoft.com/default.asp?so=RECCNT&amp;siteid=us%2Fdev&amp;p=1&amp;nq=NEW&amp;qu=VALUES&amp;IntlSearch=&amp;boolean=PHRASE&amp;ig=01&amp;i=09&amp;i=99">VALUES</a></pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">('<span style="color: #8b0000">PE0034</span>', '<span style="color: #8b0000">Visual C++ 5.0, The Complete Refference</span>', '<span style="color: #8b0000">PEMROGRAMAN</span>', '<span style="color: #8b0000">102</span>',34,0,0,0,'<span style="color: #8b0000"> </span>', 1998)</pre>
</pre>
<p>Insert query dapat juga dituliskan tanpa nama-nama field seperti di atas, asalkan jumlah field parameter yang anda cantumkan pada keyword VALUES sama dengan jumlah field yang ada ada tabel yang sedang anda insertkan. Misalnya</p>
<pre style="border: 1px solid #cecece; padding: 5px; overflow: auto; background-color: #fbfbfb; min-height: 40px; width: 500px;">
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"><a style="color: #0000ff" href="http://search.microsoft.com/default.asp?so=RECCNT&amp;siteid=us%2Fdev&amp;p=1&amp;nq=NEW&amp;qu=INSERT&amp;IntlSearch=&amp;boolean=PHRASE&amp;ig=01&amp;i=09&amp;i=99">INSERT</a> <a style="color: #0000ff" href="http://search.microsoft.com/default.asp?so=RECCNT&amp;siteid=us%2Fdev&amp;p=1&amp;nq=NEW&amp;qu=INTO&amp;IntlSearch=&amp;boolean=PHRASE&amp;ig=01&amp;i=09&amp;i=99">INTO</a> titles <a style="color: #0000ff" href="http://search.microsoft.com/default.asp?so=RECCNT&amp;siteid=us%2Fdev&amp;p=1&amp;nq=NEW&amp;qu=VALUES&amp;IntlSearch=&amp;boolean=PHRASE&amp;ig=01&amp;i=09&amp;i=99">VALUES</a></pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">('<span style="color: #8b0000">PE0034</span>', '<span style="color: #8b0000">Visual C++ 5.0, The Complete Refference</span>', '<span style="color: #8b0000">PEMROGRAMAN</span>', '<span style="color: #8b0000">102</span>',34,0,0,0,'<span style="color: #8b0000"> </span>', 1998)</pre>
</pre>
<div class="zemanta-related">
<h6 class="zemanta-related-title" style="font-size: 1em">Related articles by Zemanta</h6>
<ul class="zemanta-article-ul">
<li class="zemanta-article-ul-li"><a href="http://www.nofluffjuststuff.com/blog/cal_evans/2009/07/mysql_workbench__a_superficial_review.html?utm_source=blogitem&amp;utm_medium=rss&amp;utm_campaign=blogrss">MySQL Workbench &#8211; A Superficial Review </a>(nofluffjuststuff.com)</li>
<li class="zemanta-article-ul-li"><a href="http://petewarden.typepad.com/searchbrowser/2009/06/the-sql-trap.html">The SQL Trap </a>(petewarden.typepad.com)</li>
<li class="zemanta-article-ul-li"><a href="http://writer.fitzhome.com/software/book-review-learning-sql-second-edition-by-alan-beaulieu/">Book Review: Learning SQL, Second Edition by Alan Beaulieu </a>(writer.fitzhome.com)</li>
</ul>
</div>
<div class="zemanta-pixie" style="margin-top: 10px; height: 15px;"><a class="zemanta-pixie-a" title="Reblog this post [with Zemanta]" href="http://reblog.zemanta.com/zemified/e1e0f964-768e-4f17-8471-466b420c8102/"><img class="zemanta-pixie-img" style="border-bottom-style: none; border-right-style: none; border-top-style: none; float: right; border-left-style: none" src="http://img.zemanta.com/reblog_e.png?x-id=e1e0f964-768e-4f17-8471-466b420c8102" alt="Reblog this post [with Zemanta]" /></a></div>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://www.dijexi.com/2009/07/membuat-sistem-gps-tracking/" rel="bookmark">Membuat Sistem GPS Tracking</a></li><li><a href="http://www.dijexi.com/2009/08/how-to-mix-segment-and-query-string-in-codeigniter/" rel="bookmark">How to Mix Segment and Query String in CodeIgniter</a></li><li><a href="http://www.dijexi.com/2009/07/gps-tracking-monitoring-application-with-google-map/" rel="bookmark">GPS Tracking Monitoring Application with Google Map</a></li><li><a href="http://www.dijexi.com/2009/08/how-to-use-codeigniter-pagination-class-with-database/" rel="bookmark">How To Use CodeIgniter Pagination Class with Database</a></li><li><a href="http://www.dijexi.com/2009/07/mysql-transpose-row-into-column/" rel="bookmark">MySQL Transpose Row Into Column</a></li></ul></div><!--INFOLINKS_OFF--><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fwww.dijexi.com%2F2009%2F07%2Fmenguasai-structured-query-language-sql%2F&amp;linkname=Menguasai%20Structured%20Query%20Language%20%28SQL%29"><img src="http://www.dijexi.com/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://www.dijexi.com/2009/07/menguasai-structured-query-language-sql/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Oracle XE Installation</title>
		<link>http://www.dijexi.com/2009/06/oracle-xe-installation/</link>
		<comments>http://www.dijexi.com/2009/06/oracle-xe-installation/#comments</comments>
		<pubDate>Tue, 30 Jun 2009 10:02:56 +0000</pubDate>
		<dc:creator>akhmad daniel sembiring</dc:creator>
				<category><![CDATA[Oracle]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[database]]></category>

		<guid isPermaLink="false">http://www.dijexi.com/2009/06/oracle-xe-installation/</guid>
		<description><![CDATA[Oracle XE is a database server provided by Oracle. Download the installation and setup program from this address. Run the setup program that will show up a dialog like this: A welcome message appear, click Next A license agreement appear, click I accept the term .. , and click Next Choose the destination location for [...]]]></description>
			<content:encoded><![CDATA[<!--INFOLINKS_ON--><p>Oracle XE is a database server provided by Oracle.</p>
<p>Download the installation and setup program<a href="http://www.oracle.com/technology/software/products/database/xe/index.html" target="_blank"> from this address</a>. Run the setup program that will show up a dialog like this:</p>
<p><a href="http://www.dijexi.com/wp-content/uploads/2009/06/ora1.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="ora1" src="http://www.dijexi.com/wp-content/uploads/2009/06/ora1_thumb.png" border="0" alt="ora1" width="244" height="188" /></a></p>
<p><span id="more-365"></span></p>
<p><a href="http://www.dijexi.com/wp-content/uploads/2009/06/ora2.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="ora2" src="http://www.dijexi.com/wp-content/uploads/2009/06/ora2_thumb.png" border="0" alt="ora2" width="244" height="188" /></a></p>
<p>A welcome message appear, click Next</p>
<p><a href="http://www.dijexi.com/wp-content/uploads/2009/06/ora3.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="ora3" src="http://www.dijexi.com/wp-content/uploads/2009/06/ora3_thumb.png" border="0" alt="ora3" width="244" height="188" /></a></p>
<p>A license agreement appear, click I accept the term .. , and click Next</p>
<p><a href="http://www.dijexi.com/wp-content/uploads/2009/06/ora4.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="ora4" src="http://www.dijexi.com/wp-content/uploads/2009/06/ora4_thumb.png" border="0" alt="ora4" width="244" height="188" /></a></p>
<p>Choose the destination location for the Oracle database, which is defaulted to C:\Oraclexe. You can change the location by clicking Browse button. Click Next when you are done.</p>
<p><a href="http://www.dijexi.com/wp-content/uploads/2009/06/ora5.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="ora5" src="http://www.dijexi.com/wp-content/uploads/2009/06/ora5_thumb.png" border="0" alt="ora5" width="244" height="188" /></a></p>
<p>Choose the HTTP listener port, which is defaulted to 8081. You can change it to any available port on your system. Click Next to continue.</p>
<p><a href="http://www.dijexi.com/wp-content/uploads/2009/06/ora6.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="ora6" src="http://www.dijexi.com/wp-content/uploads/2009/06/ora6_thumb.png" border="0" alt="ora6" width="244" height="188" /></a></p>
<p>Next you must set the password for the user SYSTEM. This is the super user for the database, so please do not forget the password you set at this step. Click Next to continue.</p>
<p><a href="http://www.dijexi.com/wp-content/uploads/2009/06/ora7.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="ora7" src="http://www.dijexi.com/wp-content/uploads/2009/06/ora7_thumb.png" border="0" alt="ora7" width="244" height="188" /></a></p>
<p>Next, an installation summary will show up. Please confirm it again before committing the installation process. Click Next to continue.</p>
<p><a href="http://www.dijexi.com/wp-content/uploads/2009/06/ora8.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="ora8" src="http://www.dijexi.com/wp-content/uploads/2009/06/ora8_thumb.png" border="0" alt="ora8" width="244" height="188" /></a></p>
<p>Wait until the process is done. Click Next to continue.</p>
<p><a href="http://www.dijexi.com/wp-content/uploads/2009/06/ora9.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="ora9" src="http://www.dijexi.com/wp-content/uploads/2009/06/ora9_thumb.png" border="0" alt="ora9" width="244" height="188" /></a></p>
<p>A complete wizard appear. Check on Launch the Database homepage and click Finish to continue. Web browser will be launched to go to the database homepage.</p>
<p><a href="http://www.dijexi.com/wp-content/uploads/2009/06/ora10.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="ora10" src="http://www.dijexi.com/wp-content/uploads/2009/06/ora10_thumb.png" border="0" alt="ora10" width="244" height="141" /></a></p>
<p>Enter the System username and the password for the user you have set in the previous step.</p>
<p><a href="http://www.dijexi.com/wp-content/uploads/2009/06/ora11.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="ora11" src="http://www.dijexi.com/wp-content/uploads/2009/06/ora11_thumb.png" border="0" alt="ora11" width="244" height="226" /></a></p>
<p>Now you are on the database homepage. You can explore the Administration menu, Object Browser, SQL, and the Utilities. For now your database setup is finished, and the database can be used for application that is running using Oracle like <a href="http://www.dijexi.com/2009/06/adempiere-opensource-erp-installation/">Adempiere</a> or Compiere.</p>
<p>Akhmad Daniel Sembiring</p>
<p><a href="http://www.vitraining.com">vITraining.com &#8211; Qualified IT Products, Outsourcing, and Services</a><br />
<a href="http://ligarwangi.com">Ligarwangi.com &#8211; Linux, E-book, Coffee, Gift, etc</a></p>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://www.dijexi.com/2009/06/adempiere-opensource-erp-installation/" rel="bookmark">001 Adempiere Opensource ERP Installation</a></li><li><a href="http://www.dijexi.com/2009/07/reload-editor-installation/" rel="bookmark">Reload Editor Installation</a></li><li><a href="http://www.dijexi.com/2009/07/how-to-browse-internet-anonymously/" rel="bookmark">How To Browse Internet Anonymously</a></li><li><a href="http://www.dijexi.com/2009/07/codeigniter-tutorial-creating-accounting-application-part-1-setting-up-the-environment/" rel="bookmark">CodeIgniter Tutorial: [Creating Accounting Application] Part 1 Setting Up the Environment</a></li><li><a href="http://www.dijexi.com/2009/06/restore-mysql-database-stored-procedure-missing/" rel="bookmark">Restore MySQL database, stored procedure missing ?</a></li></ul></div><!--INFOLINKS_OFF--><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fwww.dijexi.com%2F2009%2F06%2Foracle-xe-installation%2F&amp;linkname=Oracle%20XE%20Installation"><img src="http://www.dijexi.com/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://www.dijexi.com/2009/06/oracle-xe-installation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Restore MySQL database, stored procedure missing ?</title>
		<link>http://www.dijexi.com/2009/06/restore-mysql-database-stored-procedure-missing/</link>
		<comments>http://www.dijexi.com/2009/06/restore-mysql-database-stored-procedure-missing/#comments</comments>
		<pubDate>Mon, 29 Jun 2009 23:18:08 +0000</pubDate>
		<dc:creator>akhmad daniel sembiring</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[data directory]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[restore]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[stored procedure]]></category>

		<guid isPermaLink="false">http://www.dijexi.com/2009/06/restore-mysql-database-stored-procedure-missing/</guid>
		<description><![CDATA[Backing up and Restoring mysql database could be done through several ways. You can backup and restore by exporting SQL script using MySQL command line or copying MySQL data directory from the original server to the destination server. Using the second method will cause the stored procedure and function missing. In this article we will [...]]]></description>
			<content:encoded><![CDATA[<!--INFOLINKS_ON--><p>Backing up and Restoring mysql database could be done through several ways. You can backup and restore by exporting SQL script using MySQL command line or copying MySQL data directory from the original server to the destination server.</p>
<p>Using the second method will cause the stored procedure and function missing. In this article we will discuss how to overcome the situation.</p>
<p><span id="more-224"></span></p>
<h2>Backup and Restore using MySQL command line</h2>
<p>You can backup mysql database using mysqldump command line. Using this method, you can backup and restore all information on the database, including the triggers and the stored procedures that you have on the database.</p>
<p>This command line has many parameters, but there are only some of them that we are interested. For example to backup database ialfdb, you use the command:</p>
<blockquote><p><span style="font-family: Courier New; font-size: x-small;">mysqldump ialfdb –u root –p &#8211;add-drop-table &gt; ialfdb.sql</span></p></blockquote>
<p>The above command instruct the system to export SQL statements from the database ialfdb, connecting using username root (-u root), with password that will be asked later (-p), add drop table statement for every table that will be recreated again (—add-drop-table), save the resulting SQL statement to a file named ialfdb.sql in the current directory ( &gt; ialfdb.sql ).</p>
<p>If the system was failed to executed mysqldump program then try to run it using the full path (typing the program’s exact location), for example: c:\xampp\mysql\bin\mysqldump or c:\program files\mysql\bin\mysqldump.</p>
<p>You can specify the destination directory for SQL file for the output by typing the file with it’s full path, for example c:\data\ialfdb.sql.</p>
<p>When the command is executed, it will ask you for a password, that is the password for user specified by –u parameter (root).</p>
<blockquote><p>Enter password:</p></blockquote>
<p>Just type the user’s password. Depending to the size of the database, it will take a while to process your request. After the process is done, you will be back to the command prompt.</p>
<p>Below is a screen capture of the command line session. I used it on Windows operating system, but there will be no big different on other operating system.</p>
<p><a href="http://www.dijexi.com/wp-content/uploads/2009/06/image27.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" src="http://www.dijexi.com/wp-content/uploads/2009/06/image_thumb27.png" border="0" alt="image" width="244" height="125" /></a></p>
<p>To restore the database, you should use the command line mysql. Again we are only interested in a few of all the parameter that the program has. To restore our backup file above (ialfdb.sql), use the command line:</p>
<blockquote><p>mysql ialfdb –u root –p &lt; ialfdb.sql</p></blockquote>
<p>The command line above tell the system to restore the SQL scripts on the file ialfdb.sql ( &lt; ialfdb.sql ), using user root to connect to the database ( –u root ), with password that will be asked later.</p>
<p>If the system was failed to executed mysql program then try to run it using the full path (typing the program’s exact location), for example: c:\xampp\mysql\bin\mysql or c:\program files\mysql\bin\mysql.</p>
<p>You can specify the source directory of the SQL script file by typing the file with it’s full path, for example c:\data\ialfdb.sql.</p>
<p>When the command is executed, it will ask you for a password, that is the password for user specified by –u parameter (root).</p>
<blockquote><p>Enter password:</p></blockquote>
<p>Just type the user’s password. Depending to the size of the database, it will take a while to process your request. After the process is done, you will be back to the command prompt.</p>
<p>Below is a screen capture of the command line session. I used it on Windows operating system, but there will be no big different on other operating system.</p>
<p><a href="http://www.dijexi.com/wp-content/uploads/2009/06/image61.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" src="http://www.dijexi.com/wp-content/uploads/2009/06/image6_thumb.png" border="0" alt="image" width="244" height="125" /></a></p>
<h2>Backup and Restore by Copying the Data Directory</h2>
<p>You could also backup and restore MySQL database by copying the data directory from a server to other server. By default, MySQL data directory resides on the data directory below the server installation path, for example c:\program files\mysql\data or c:\xampp\mysql\data. There will be directories for your database, in our case is the ialfdb directory.</p>
<p>Simply copy the data directory from the source server to the destination server using Windows Explorer.</p>
<p><a href="http://www.dijexi.com/wp-content/uploads/2009/06/image28.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Location of database directory of MySQL database" src="http://www.dijexi.com/wp-content/uploads/2009/06/image_thumb28.png" border="0" alt="Location of database directory of MySQL database" width="430" height="464" /></a></p>
<p>The problem is when your database contains stored procedures and functions. You cannot simply the database directory, but you need also to copy the proc tables under the mysql directory. The files for that tables are: proc.myi, proc.myd, and proc.frm.</p>
<p><a href="http://www.dijexi.com/wp-content/uploads/2009/06/image29.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="The proc table files" src="http://www.dijexi.com/wp-content/uploads/2009/06/image_thumb29.png" border="0" alt="The proc table files" width="430" height="464" /></a></p>
<p>Of course, other stored procedure and function which are belong to (created at) other database will be copied also in the new database.</p>
<p>That’s all, hope this article is useful for you. Please leave me a comment if you have something to discuss.</p>
<p>Akhmad Daniel Sembiring<br />
<a href="http://www.vitraining.com" target="_blank">vITraining.com</a><br />
<a href="http://ligarwangi.com" target="_blank">Ligarwangi.com &#8211; toserba online</a></p>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://www.dijexi.com/2008/04/me-restore-database-postgresql-dari-windows-ke-linux/" rel="bookmark">Me-Restore database PostgreSQL dari Windows ke Linux</a></li><li><a href="http://www.dijexi.com/2009/06/codeigniter-konek-ke-port-mysql-tertentu-selain-3306/" rel="bookmark">CodeIgniter: koneksi ke port MySQL tertentu selain 3306</a></li><li><a href="http://www.dijexi.com/2009/06/mysql-backup-with-phpmybackuppro/" rel="bookmark">MySQL Backup with phpMyBackupPro</a></li><li><a href="http://www.dijexi.com/2009/06/tutorial-membuat-aplikasi-database-ikan/" rel="bookmark">13. Aplikasi Database Ikan</a></li><li><a href="http://www.dijexi.com/2009/08/codeigniter-tutorial-creating-accounting-application-part-3-er-diagram-and-creating-database/" rel="bookmark">CodeIgniter Tutorial: [Creating Accounting Application] Part 3 ER Diagram and Creating Database</a></li></ul></div><!--INFOLINKS_OFF--><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fwww.dijexi.com%2F2009%2F06%2Frestore-mysql-database-stored-procedure-missing%2F&amp;linkname=Restore%20MySQL%20database%2C%20stored%20procedure%20missing%20%3F"><img src="http://www.dijexi.com/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://www.dijexi.com/2009/06/restore-mysql-database-stored-procedure-missing/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>CodeIgniter: koneksi ke port MySQL tertentu selain 3306</title>
		<link>http://www.dijexi.com/2009/06/codeigniter-konek-ke-port-mysql-tertentu-selain-3306/</link>
		<comments>http://www.dijexi.com/2009/06/codeigniter-konek-ke-port-mysql-tertentu-selain-3306/#comments</comments>
		<pubDate>Mon, 29 Jun 2009 23:05:05 +0000</pubDate>
		<dc:creator>akhmad daniel sembiring</dc:creator>
				<category><![CDATA[CodeIgniter]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[connect]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database driver]]></category>
		<category><![CDATA[database drivers]]></category>
		<category><![CDATA[driver database]]></category>
		<category><![CDATA[file]]></category>
		<category><![CDATA[file ini]]></category>
		<category><![CDATA[koneksi]]></category>
		<category><![CDATA[port]]></category>
		<category><![CDATA[string]]></category>

		<guid isPermaLink="false">http://www.dijexi.com/2009/06/codeigniter-konek-ke-port-mysql-tertentu-selain-3306/</guid>
		<description><![CDATA[Secara default, database driver MySQL CodeIgniter konek ke port default MySQL yaitu 3306. Pada kondisi dimana port MySQL bukan 3306 misalnya 3307, CodeIgniter tidak punya option untuk menentukan pada port berapa MySQL berjalan. Solusi untuk hal ini dapat dilakukan dengan beberapa cara: mengedit file driver database CodeIgniter: system/database/drivers/mysqli/mysqli_driver.php. Pada file ini dapat ditentukan port MySQL [...]]]></description>
			<content:encoded><![CDATA[<!--INFOLINKS_ON--><p>Secara default, database driver MySQL CodeIgniter konek ke port default MySQL yaitu 3306. Pada kondisi dimana port MySQL bukan 3306 misalnya 3307, CodeIgniter tidak punya option untuk menentukan pada port berapa MySQL berjalan.</p>
<p>Solusi untuk hal ini dapat dilakukan dengan beberapa cara:</p>
<ol>
<li>mengedit file driver database CodeIgniter: <strong>system/database/drivers/mysqli/mysqli_driver.php.</strong> Pada file ini dapat ditentukan port MySQL pada function ‘db_connect’ yaitu dengan menambahkan parameter $port pada function tsb: <strong>       <br />mysqli_connect</strong> ( [string $host [, string $username [, string $passwd [, string $dbname [, int $port [, string $socket]]]]]] ) </li>
<li>mengedit file PHP.INI, pada bagian&#160; mysql.default_port, ganti dari 3306 menjadi 3307 </li>
<li>jika tidak punya akses ke file PHP.INI, bisa juga dicoba dengan mengedit file <strong>config/database.php</strong> nya CodeIgniter yaitu pada baris:
<div class="codeblock"><code><span style="color: #0000bb">$db[</span><span style="color: #dd0000">'default'</span><span style="color: #0000bb">][</span><span style="color: #dd0000">'hostname'</span><span style="color: #0000bb">] </span><span style="color: #007700">= </span><span style="color: #dd0000">&quot;mysqlhost.yourdomain.com:3307&quot;</span><span style="color: #007700">;</span></code></div>
</li>
</ol>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://www.dijexi.com/2009/06/portable-apache-mysql-php/" rel="bookmark">Portable Apache, MySQL, PHP</a></li><li><a href="http://www.dijexi.com/2009/05/sql-express-meng-enable-koneksi-remote-melalui-tcpip/" rel="bookmark">SQL Express: meng-enable koneksi remote melalui TCP/IP</a></li><li><a href="http://www.dijexi.com/2009/06/perl-konek-ke-postgresql/" rel="bookmark">Perl connection to PostgreSQL</a></li><li><a href="http://www.dijexi.com/2009/07/codeigniter-tutorial-creating-accounting-application-part-1-setting-up-the-environment/" rel="bookmark">CodeIgniter Tutorial: [Creating Accounting Application] Part 1 Setting Up the Environment</a></li><li><a href="http://www.dijexi.com/2009/06/meng-connect-in-php-ke-postgresql/" rel="bookmark">PHP Connection to PostgreSQL</a></li></ul></div><!--INFOLINKS_OFF--><p style="text-align: center;"><script type="text/javascript"><!--
google_ad_client = "pub-7773800616131770";
/* horizontal */
google_ad_slot = "1931057994";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fwww.dijexi.com%2F2009%2F06%2Fcodeigniter-konek-ke-port-mysql-tertentu-selain-3306%2F&amp;linkname=CodeIgniter%3A%20koneksi%20ke%20port%20MySQL%20tertentu%20selain%203306"><img src="http://www.dijexi.com/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://www.dijexi.com/2009/06/codeigniter-konek-ke-port-mysql-tertentu-selain-3306/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>PHP Connection to PostgreSQL</title>
		<link>http://www.dijexi.com/2009/06/meng-connect-in-php-ke-postgresql/</link>
		<comments>http://www.dijexi.com/2009/06/meng-connect-in-php-ke-postgresql/#comments</comments>
		<pubDate>Mon, 29 Jun 2009 23:03:33 +0000</pubDate>
		<dc:creator>akhmad daniel sembiring</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[PostgreSQL]]></category>
		<category><![CDATA[connection string]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[pg_connect]]></category>
		<category><![CDATA[query]]></category>
		<category><![CDATA[tcp ip]]></category>

		<guid isPermaLink="false">http://www.dijexi.com/2009/06/meng-connect-in-php-ke-postgresql/</guid>
		<description><![CDATA[Berikut ini langkah langkah yang perlu diperhatikan ketika membuat aplikasi PHP yang connect ke database PostgreSQL. Function pg_connect Langkah pertama adalah memanggil function pg_connect() untuk melakukan koneksi ke database server. $dbconn = pg_connect ($conn_string); Parameter function ini adalah connection string yang berisi definisi host, user, password, nama database yang ada di server PostgreSQL. Jika salah [...]]]></description>
			<content:encoded><![CDATA[<!--INFOLINKS_ON--><p>Berikut ini langkah langkah yang perlu diperhatikan ketika membuat aplikasi PHP yang connect ke database PostgreSQL.</p>
<h2>Function pg_connect</h2>
<p>Langkah pertama adalah memanggil function pg_connect() untuk melakukan koneksi ke database server.</p>
<pre style="padding-left: 30px">$dbconn = pg_connect ($conn_string);</pre>
</p>
<p><span id="more-213"></span>Parameter function ini adalah connection string yang berisi definisi host, user, password, nama database yang ada di server PostgreSQL. Jika salah satu definisi tidak digunakan maka artinya nilai default pada server tersebut yang digunakan. </p>
<p align="left"><script type="text/javascript"><!--
zone = "33";
pl = "21951";
shape = "1";
c_border = "FFFFFF";
c_background = "FFFFFF";
c_text1 = "0000FF";
c_text2 = "0000FF";
c_text3 = "000000";
c_text4 = "000000";
c_text5 = "000000";
c_text6 = "000000";
c_text8 = "0000ff";
url = "http://www.ppcindo.com";
//--></script><script type="text/javascript" src="http://www.ppcindo.com/show.js"></script></p>
<p>Beberapa contohnya adalah sbb:</p>
<p>Konek ke database yang namanya &quot;tokobaju&quot;</p>
<pre style="padding-left: 30px">$dbconn = pg_connect (&quot;dbname=tokobaju&quot;);</pre>
<p>
  <br />Konek ke database yang namanya &quot;tokobaju&quot; pada server postgresql yang ada di &quot;localhost&quot; dan port &quot;5432&quot; </p>
<p></p>
<pre style="padding-left: 30px">$dbconn2 = pg_connect (&quot;host=localhost port=5432 dbname=tokobaju&quot;);</pre>
<p>
  <br />Konek ke database yang namanya &quot;tokobaju&quot; pada komputer dengan hostname &quot;sheep&quot; dengan menggunakan username dan password: </p>
<p></p>
<pre style="padding-left: 30px; width: 509px; height: 48px">$dbconn3 = pg_connect (&quot;host=sheep port=5432 dbname=tokobaju user=lamb password=foo&quot;);</pre>
<p>
  <br />Konek ke database yang namanya &quot;test&quot; pada komputer dengan hostname &quot;sheep&quot; dengan username dan password dengan terlebih dahulu mendefinisikannya pada variabel string: </p>
<p></p>
<pre style="padding-left: 30px; width: 509px; height: 50px">$conn_string = &quot;host=sheep port=5432 dbname=test user=lamb password=bar&quot;;
$dbconn4 = pg_connect ($conn_string);</pre>
<p align="left"><script language="javascript"><!--//
var server_client_id = 1672;
var server_ad_width = 468;  
var server_ad_height = 60;
var server_ad_style = "468x60_as";
var server_code_version = "4";
var server_ad_color_border = "111111";
var server_ad_color_background = "CCCCCC";
var server_ad_color_headline = "7E8AA2";
var server_ad_color_body = "000000";
var server_ad_color_url = "666EBA";
var server_ad_keyword = "";  
var server_ad_channel = 1;
var server_publisher_channels = "";
var server_ad_random = 1;</p>
<p>//--></script><script type="text/javascript" src="http://www.adsklix.com/ads/display_ads.php">
</script></p>
<p><span style="text-decoration: underline">Catatan</span></p>
<p>PHP melakukan koneksi ke server postgres melalui TCP/IP jadi server PostgreSQL nya harus diset supaya bisa menerima koneksi via TCP/IP. Ini dilakukan dengan setting pada file postgresql.conf. Pastikan bahwa baris port sudah di uncomment:</p>
<pre style="padding-left: 30px">port = 5432</pre>
<p>
  <br />JIka koneksi juga dilakukan selain dari localhost, pastikan bahwa baris listen_address juga sudah diuncomment dan memuat daftar IP address yang diperbolehkan untuk melakukan koneksi, misalnya: </p>
<p></p>
<pre style="padding-left: 30px">listen_addresses = 'localhost'  , '192.168.0.233'</pre>
<p>
  <br />User, password , dan metoda autentikasi juga harus disetting supaya PHP berhasil konek ke PostgreSQL, ini dilakukan dengan setting file pg_hba.conf. Misalnya pada baris sbb: </p>
<p></p>
<pre>#TYPE  DATABASE    USER        CIDR-ADDRESS          METHOD
host    all         all         127.0.0.1/32          md5</pre>
<p>yang artinya, host (komputer) dengan IP address 127.0.0.1 dapat konek ke semua database yang ada pada server dengan menggunakan semua user yang ada, dengan menggunakan metoda autentikasi MD5.</p>
<h2>Function pg_query</h2>
<p align="left">
<div style="padding-right: 20px; float: left"><iframe style="border-bottom: medium none; border-left: medium none; border-top: medium none; border-right: medium none" height="600" marginheight="0" border="0" src="http://rcm.amazon.com/e/cm?t=vitrainingcom-20&amp;o=1&amp;p=14&amp;l=st1&amp;mode=books&amp;search=postgresql&amp;fc1=000000&amp;lt1=&amp;lc1=3366FF&amp;bg1=FFFFFF&amp;f=ifr" frameborder="0" width="160" marginwidth="0" scrolling="no"></iframe></div>
<p><!-- Adsense End --></p>
<p>Selanjutnya gunakan function <strong class="methodname">pg_query</strong> ( resource connection, string query) untuk melakukan query ke database.</p>
<p>Misalnya</p>
<pre style="padding-left: 30px">$sql=&quot;select * from produk&quot;;
$res = pg_query($dbconn, $sql);</pre>
<p>Function ini memerlukan 2 parameter yaitu connection result yang dihasilkan dari function pg_connect, dan definisi SQL query. Contoh diatas melakukan query select ke tabel produk pada database yang telah dikonek melalui connection result $dbconn. Hasilnya berupa query result yang ditampung pada variabel $res.</p>
<h2>Function pg_fetch_array</h2>
<p>Setelah query berhasil dilakukan, maka selanjutnya diambil menggunakan function pg_fetch_array.</p>
<p>array <strong class="methodname">pg_fetch_array</strong> ( resource result [, int row [, int result_type]])</p>
<p>Parameter function ini adalah result query yang dihasilkan dari pg_query, dan parameter optional dimulai dari baris keberapa (defaultnya 0), dan parameter optional yang mengontrol return value function ini apakah berupa array associative (PGSQL_ASSOC) atau array field index (PGSQL_NUM) atau keduanya (PGSQL_BOTH). Defaultnya adalah PGSQL_BOTH.</p>
<p>Setiap kali dipanggil function ini mengeluarkan satu baris hasil query, sampai dengan baris tersebut habis. Jika sudah habis maka return value nya adalah FALSE.</p>
<p>Sebagai contoh:</p>
<pre style="padding-left: 30px">$row = 0; // postgres needs a row counter other dbs might not
while ($data = pg_fetch_array($res, $row))
{
    echo $data['merk'];
    echo $data['harga'].&quot;&lt;BR&gt;&quot;;
    $row++;
}</pre>
<p>Contoh diatas melakukan looping sambil memanggil function pg_fetch_array selama hasilnya ada (masih ada record) dan menampung hasilnya pada array $data.&#160; Jika masih ada, maka echo kan $data['merk'] dan $data['harga'] dimana merk dan harga adalah nama field yang ada pada tabel produk. Cara pemanggilan field disini menggunakan associative array. Bisa juga dilakukan dengan index field yaitu $data[0] dan $data[1].</p>
<h2>Contoh Program Lengkap</h2>
<p>Ini dia contoh programnya yang lengkap, diambil dari help PHP.</p>
<pre style="padding-left: 30px">&lt;?php
   $conn = pg_pconnect (&quot;dbname=tokobaju&quot;);
   if (!$conn) {
     echo &quot;An error occured.\n&quot;;
     exit;
   }

   $result = pg_query ($conn, &quot;SELECT * FROM authors&quot;);
   if (!$result) {
     echo &quot;An error occured.\n&quot;;
     exit;
   }

   $row = 0; // postgres needs a row counter other dbs might not
   while ($data = pg_fetch_array($res, $row))
   {
      echo $data['merk'];
      echo $data['harga'].&quot;&lt;BR&gt;&quot;; $row++; }
?&gt;</pre>
</p>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:ab5a1412-c2bb-4b0a-a2df-8c254b0c9615" class="wlWriterEditableSmartContent">Technorati Tags: <a href="http://technorati.com/tags/connection+string" rel="tag">connection string</a>,<a href="http://technorati.com/tags/database" rel="tag">database</a>,<a href="http://technorati.com/tags/pg_connect" rel="tag">pg_connect</a>,<a href="http://technorati.com/tags/PHP" rel="tag">PHP</a>,<a href="http://technorati.com/tags/PostgreSQL" rel="tag">PostgreSQL</a>,<a href="http://technorati.com/tags/query" rel="tag">query</a>,<a href="http://technorati.com/tags/tcp+ip" rel="tag">tcp ip</a></div>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://www.dijexi.com/2009/07/php-library-to-connect-to-ldap-server/" rel="bookmark">PHP Library to Connect to LDAP Server</a></li><li><a href="http://www.dijexi.com/2009/05/koneksi-ms-sql-server-dengan-c-sharp/" rel="bookmark">Koneksi MS SQL Server dengan C-Sharp</a></li><li><a href="http://www.dijexi.com/2009/06/perl-konek-ke-postgresql/" rel="bookmark">Perl connection to PostgreSQL</a></li><li><a href="http://www.dijexi.com/2010/08/creating-gps-tracker-application-on-j2me-phones/" rel="bookmark">Creating GPS Tracker Application on J2ME Phones</a></li><li><a href="http://www.dijexi.com/2008/04/me-restore-database-postgresql-dari-windows-ke-linux/" rel="bookmark">Me-Restore database PostgreSQL dari Windows ke Linux</a></li></ul></div><!--INFOLINKS_OFF--><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fwww.dijexi.com%2F2009%2F06%2Fmeng-connect-in-php-ke-postgresql%2F&amp;linkname=PHP%20Connection%20to%20PostgreSQL"><img src="http://www.dijexi.com/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://www.dijexi.com/2009/06/meng-connect-in-php-ke-postgresql/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>MySQL Backup with phpMyBackupPro</title>
		<link>http://www.dijexi.com/2009/06/mysql-backup-with-phpmybackuppro/</link>
		<comments>http://www.dijexi.com/2009/06/mysql-backup-with-phpmybackuppro/#comments</comments>
		<pubDate>Mon, 29 Jun 2009 09:44:35 +0000</pubDate>
		<dc:creator>akhmad daniel sembiring</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[apache web server]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[browser ie]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database info]]></category>
		<category><![CDATA[directory]]></category>
		<category><![CDATA[file]]></category>
		<category><![CDATA[manual backup]]></category>
		<category><![CDATA[mysql password]]></category>
		<category><![CDATA[periodic]]></category>
		<category><![CDATA[restore]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[Select]]></category>
		<category><![CDATA[sql command]]></category>
		<category><![CDATA[sql data]]></category>
		<category><![CDATA[table]]></category>
		<category><![CDATA[task]]></category>
		<category><![CDATA[xampp]]></category>

		<guid isPermaLink="false">http://www.dijexi.com/2009/06/mysql-backup-with-phpmybackuppro/</guid>
		<description><![CDATA[phpMyBackupPro is a tool created using PHP programming language that can be used to perform backup and restore on MySQL database server. In this article we are going to learn how to install and configure this tool, perform manual backup and then perform restore the previously backed up database. We will also learn how to [...]]]></description>
			<content:encoded><![CDATA[<!--INFOLINKS_ON--><p>phpMyBackupPro is a tool created using PHP programming language that can be used to perform backup and restore on MySQL database server. In this article we are going to learn how to install and configure this tool, perform manual backup and then perform restore the previously backed up database. We will also learn how to setup an automatic periodic backup using the same tool.</p>
<h2>Installation</h2>
<p>Installation of this tool is simple. Just download the newest version from <a title="http://www.phpmybackuppro.net/download.php" href="http://www.phpmybackuppro.net/download.php">http://www.phpmybackuppro.net/download.php</a>. </p>
<p>After downloading, extract the zip file to a directory on your PHP and Apache web server accessible from browser, ie the Document Root, for example C:\XAMPP\HTDOCS. Then you will get a new folder under it, for example C:\XAMPP\HTDOCS\phpMyBackupPro.</p>
<p>That’s it! Now go to your web browser and point the URL of phpMyBackupPro, for example <a href="http://localhost/phpMyBackupPro">http://localhost/phpMyBackupPro</a>.</p>
<p> <span id="more-192"></span><br />
<h2>Configuration</h2>
<p>After successfully copying the files, and pointing your browser to the URL , you will get a page similar to the following:</p>
<p><a href="http://www.dijexi.com/wp-content/uploads/2009/06/image19.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Start Page of phpMyBackupPro" border="0" alt="Start Page of phpMyBackupPro" src="http://www.dijexi.com/wp-content/uploads/2009/06/image_thumb19.png" width="504" height="251" /></a> </p>
<p>As you can see, there are several tabs that we need to explore:</p>
<ol>
<li>Start, the current page, showing the system information </li>
<li>Configuration, the place to do some system configuration </li>
<li>Import, to import recently backed up databases </li>
<li>Backup, to do backing up of databases </li>
<li>Scheduled backup, to create a script to do an automatic backup regularly </li>
<li>Database info, showing detailed database information </li>
<li>SQL query, to do arbitrary SQL command on the server </li>
</ol>
<p>To configuring the system, click on the Configuration tab. You will see a page like the following:</p>
<p><a href="http://www.dijexi.com/wp-content/uploads/2009/06/image20.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://www.dijexi.com/wp-content/uploads/2009/06/image_thumb20.png" width="504" height="251" /></a> </p>
<p>On that page, you need to adjust the configuration according to your system. That will be:</p>
<ol>
<li>Site name: the name of your site or application to backup </li>
<li>Language: english </li>
<li>SQL Data (<strong>mandatory settings</strong>)
<ol>
<li>MySQL hostname: the host name or IP address of your MySQL server </li>
<li>MySQL username: the user name to connect to your MySQL server </li>
<li>MySQL password: the password for the user name to connect to your MySQL server </li>
<li>only this database: enter the name of the database if you need to backup only that database, otherwise leave it blank so that phpMyBackupPro can backup all of databases on the server </li>
</ol>
</li>
<li>FTP Settings (optional), set it up only if you want to save (upload) the backup file to an FTP server
<ol>
<li>Save backup per FTP server ? check on it if you want to save (upload) the backup file to an FTP server </li>
<li>FTP server, fill with the hostname or IP Address of the FTP server </li>
<li>FTP username: the username to connect to the FTP server </li>
<li>FTP password: the password of the username to connect to the FTP server </li>
<li>FTP path: the location of the backup file on the FTP server </li>
<li>User passive FTP: check it if you are using passive FTP server </li>
<li>FTP Port: the port number of the FTP server, or leave it to 21 for the default number </li>
<li>delete files on FTP server: </li>
</ol>
</li>
<li>Backup per Email, set it up if you want to send the backup file to an email address
<ol>
<li>use email: check it if you want to send the backup file to an email address </li>
<li>email address: enter the email address to receive the backup file </li>
</ol>
</li>
</ol>
</p>
<p>Click on the Save button when you are done.</p>
<p>That’s all for the basic configuration. Your backup system can now be operated to do the backup and restore process from the same URL address. You may check also the Extended Configuration and the System Variables section.</p>
<h2>Performing Manual Backup</h2>
<p>After successfully configure your system, now you can do the backup process. Click on the Backup tab, then a page like the following will be shown:</p>
<p><a href="http://www.dijexi.com/wp-content/uploads/2009/06/image21.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://www.dijexi.com/wp-content/uploads/2009/06/image_thumb21.png" width="504" height="269" /></a> </p>
<p>You need to do the following steps to backup database(s):</p>
<ol>
<li>Select the database(s) to backup, click on the databases list; to select more than one database, use CTRL-click (press CTRL button on your keyboard and then click your mouse). You may click “select all” to select all of your database listed. </li>
<li>double check the options to
<ol>
<li>“export tables”, whether you want to backup the table definition or not </li>
<li>“export data”, whether you want to backup the table data or not </li>
<li>“add drop table”, whether you want to add the drop table statement or not, before the create table statement </li>
<li>compression, select one of none, gzip, or zip </li>
</ol>
</li>
<li>Select directories to backup to FTP server, select the directory on your FTP server (if you set it up before on the configuration step), or you can add manual FTP directories on the box right to the directory list. You may also check on the “Packed in One ZIP file”. </li>
<li>Click Backup button when you are done. </li>
</ol>
<p>That’s all. You backup is now complete.</p>
<h2>Performing Restore</h2>
<p>To do the restore of a previously backed up database, click on the Import tab. A page similar to the following will show:</p>
<p><a href="http://www.dijexi.com/wp-content/uploads/2009/06/image22.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://www.dijexi.com/wp-content/uploads/2009/06/image_thumb22.png" width="504" height="273" /></a> </p>
<p>On that page you will see a list several files grouped by the database name corresponding to the backup process. On that list of files, there are some information like the file name, date time the backup is created, and the file size.</p>
<p>To restore a database, simply click “import” link on the file list that correspond to the database to be restored and the date the backup was performed.</p>
<p>There are other options that you can do:</p>
<p>The backup information, clicking the “info” link, will show the following information:</p>
<p><a href="http://www.dijexi.com/wp-content/uploads/2009/06/image4.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://www.dijexi.com/wp-content/uploads/2009/06/image_thumb4.png" width="404" height="291" /></a> </p>
</p>
<p>The SQL statement view, clicking the “view” link, will show the following information:</p>
<p><a href="http://www.dijexi.com/wp-content/uploads/2009/06/image23.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://www.dijexi.com/wp-content/uploads/2009/06/image_thumb23.png" width="502" height="392" /></a> </p>
<p>To download the backup file, click on the “download” link.</p>
<p>To delete the backup file, click on the “delete” link.</p>
<p align="left"><script type="text/javascript"><!--
google_ad_client = "pub-7773800616131770";
/* horizontal */
google_ad_slot = "1931057994";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script><script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></p>
<p align="left">&#160;</p>
<h2>Performing Scheduled Backup</h2>
<p>To do the backup periodically, go to the Scheduled Backup tab, you will see a page similar to the following:</p>
<p><a href="http://www.dijexi.com/wp-content/uploads/2009/06/image24.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://www.dijexi.com/wp-content/uploads/2009/06/image_thumb24.png" width="504" height="352" /></a> </p>
<p>You need to do the following steps to setup a periodic backup database(s):</p>
<ol>
<li>Select the backup period: for example: each time the script is called, every 1 hour, every 6 hours, etc. </li>
<li>Select directory where the PHP script file generated will be placed. Leave it to ./ to place the file on the same directory to phpMyBackupPro directory. (You may need to click on “Update directory list”&#160; to refresh the directory listing, in case you create a new directory) </li>
<li>Select the database(s) to backup, click on the databases list; to select more than one database, use CTRL-click (press CTRL button on your keyboard and then click your mouse). You may click “select all” to select all of your database listed. </li>
<li>double check the options to
<ol>
<li>“export tables”, whether you want to backup the table definition or not </li>
<li>“export data”, whether you want to backup the table data or not </li>
<li>“add drop table”, whether you want to add the drop table statement or not, before the create table statement </li>
<li>compression, select one of none, gzip, or zip </li>
</ol>
</li>
<li>Select directories to backup to FTP server, select the directory on your FTP server (if you set it up before on the configuration step), or you can add manual FTP directories on the box right to the directory list. You may also check on the “Packed in One ZIP file”. </li>
<li>Click Show Script button when you are done. </li>
</ol>
<p>The following page will appear:</p>
<p><a href="http://www.dijexi.com/wp-content/uploads/2009/06/image25.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://www.dijexi.com/wp-content/uploads/2009/06/image_thumb25.png" width="504" height="273" /></a> </p>
<p>The page shows a PHP script to be run to do the backup. Enter the file name for the script, for example script.php, then click Save data. The file will be created on the directory specified at the previuos step.</p>
<p>After it is generated, you can run the script by the following ways:</p>
<ol>
<li>run it using cron tabs (on Linux), or using Task Scheduler (on Windows, see below) </li>
<li>run it using command line </li>
</ol>
<p>That’s all. You backup script is now complete. To restore the backup, do the same way as restoring backup created by manual backup.</p>
<h2>Setting up Windows Task Scheduler</h2>
<h3>Add New Scheduled Task</h3>
<p>If you need to run the backup script periodically using the Windows Task Scheduler, do the following steps:</p>
<p>Click on Start – Settings &#8211; Control Panel – Scheduled Tasks</p>
<p>Double click Add Scheduled Task</p>
<p><a href="http://www.dijexi.com/wp-content/uploads/2009/06/image8.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://www.dijexi.com/wp-content/uploads/2009/06/image_thumb8.png" width="244" height="181" /></a> </p>
<p>Click Next.</p>
<p><a href="http://www.dijexi.com/wp-content/uploads/2009/06/image9.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://www.dijexi.com/wp-content/uploads/2009/06/image_thumb9.png" width="244" height="181" /></a> </p>
<p>Click Browse… and locate the PHP.EXE executable file, for example C:\XAMPP\PHP\PHP.EXE.</p>
<p><a href="http://www.dijexi.com/wp-content/uploads/2009/06/image10.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://www.dijexi.com/wp-content/uploads/2009/06/image_thumb10.png" width="244" height="181" /></a> </p>
<p>Select the execution period of Daily, Weekly, Monthly, etc depending on your backup need. Click Next.</p>
<p><a href="http://www.dijexi.com/wp-content/uploads/2009/06/image11.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://www.dijexi.com/wp-content/uploads/2009/06/image_thumb11.png" width="244" height="181" /></a> </p>
<p>Select the start time and Date of the task. Also select the daily operation for the task, eg Every Day, Weekdays only, or Every x days. Click Next.</p>
<p><a href="http://www.dijexi.com/wp-content/uploads/2009/06/image12.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://www.dijexi.com/wp-content/uploads/2009/06/image_thumb12.png" width="244" height="181" /></a> </p>
<p>Next, Enter the username and password that will run the program as. Click Next.</p>
<p><a href="http://www.dijexi.com/wp-content/uploads/2009/06/image13.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://www.dijexi.com/wp-content/uploads/2009/06/image_thumb13.png" width="244" height="181" /></a> </p>
<h3>Refine the Scheduled Task</h3>
<p>On the dialog, the task periodic schedule is shown, you can refine it by checking “Open advanced properties for this task when I click Finish”. Then click Finish.</p>
<p><a href="http://www.dijexi.com/wp-content/uploads/2009/06/image14.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://www.dijexi.com/wp-content/uploads/2009/06/image_thumb14.png" width="410" height="459" /></a> </p>
<p>You need to change the Run field from</p>
<blockquote><p>c:\xampp\php\php.exe</p>
</blockquote>
<p>to</p>
<blockquote><p>C:\xampp\php\php.exe c:\xampp\htdocs\phpMyBackupPro\script.php db1,db2</p>
</blockquote>
<p>where db1, db2, etc is the database name to backup.</p>
<p>You may need to put a double quote on the command line parameter if your script resides on a folder that contains spaces, for example:</p>
<blockquote><p>C:\xampp\php\php.exe&#160; “C:\Documents and Settings\Toshiba\My Documents\backup\script.php” db1,db2</p>
</blockquote>
<p>This will run php program with an argument, which is our backup script created before.</p>
<p>If you need to adjust the period, you can click on the Schedule tab.</p>
<p><a href="http://www.dijexi.com/wp-content/uploads/2009/06/image15.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://www.dijexi.com/wp-content/uploads/2009/06/image_thumb15.png" width="410" height="459" /></a> </p>
<p>and then click Advanced button</p>
<p><a href="http://www.dijexi.com/wp-content/uploads/2009/06/image16.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://www.dijexi.com/wp-content/uploads/2009/06/image_thumb16.png" width="372" height="304" /></a> </p>
<p>On the above example, we check on Repeat task, which means we will run the backup program every 6 hours for 24 hours a day, starting from 29 June 2009. Click OK.</p>
<p>Our scheduled task will be listed at the Scheduled Tasks window as follow:</p>
<p><a href="http://www.dijexi.com/wp-content/uploads/2009/06/image26.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://www.dijexi.com/wp-content/uploads/2009/06/image_thumb26.png" width="504" height="261" /></a> </p>
<h3>Modify the PHP Script</h3>
<p>The final step is to modify the script.php so that the included path is correct. The original script.php file is for example as follow:</p>
<pre style="width: 500px; height: 252px" class="csharpcode">&lt;?php
<span class="rem">// This code was created by phpMyBackupPro v.2.1 </span>
<span class="rem">// http://www.phpMyBackupPro.net</span>
$_POST[<span class="str">'db'</span>]=array(<span class="str">&quot;cibpdb&quot;</span>, <span class="str">&quot;mysql&quot;</span>, );
$_POST[<span class="str">'tables'</span>]=<span class="str">&quot;on&quot;</span>;
$_POST[<span class="str">'data'</span>]=<span class="str">&quot;on&quot;</span>;
$_POST[<span class="str">'drop'</span>]=<span class="str">&quot;on&quot;</span>;
$_POST[<span class="str">'zip'</span>]=<span class="str">&quot;zip&quot;</span>;
$period=(3600*24)/2;
$security_key=<span class="str">&quot;e24c0df313d1cbc9a1e7258811ba5342&quot;</span>;
<span class="rem">// This is the relative path to the phpMyBackupPro v.2.1 directory</span>
@chdir(<span class="str">&quot;../backup/&quot;</span>);
@include(<span class="str">&quot;backup.php&quot;</span>);
?&gt;</pre>
<p>Next, modify line contains @chdir command to point to the correct absolute folder where the phpMyBackupPro folder (the file named backup.php) resides, for example:</p>
<pre style="width: 500px; height: 252px" class="csharpcode">&lt;?php
<span class="rem">// This code was created by phpMyBackupPro v.2.1 </span>
<span class="rem">// http://www.phpMyBackupPro.net</span>
$_POST[<span class="str">'db'</span>]=array(<span class="str">&quot;cibpdb&quot;</span>, <span class="str">&quot;mysql&quot;</span>, );
$_POST[<span class="str">'tables'</span>]=<span class="str">&quot;on&quot;</span>;
$_POST[<span class="str">'data'</span>]=<span class="str">&quot;on&quot;</span>;
$_POST[<span class="str">'drop'</span>]=<span class="str">&quot;on&quot;</span>;
$_POST[<span class="str">'zip'</span>]=<span class="str">&quot;zip&quot;</span>;
$period=(3600*24)/2;
$security_key=<span class="str">&quot;e24c0df313d1cbc9a1e7258811ba5342&quot;</span>;
<span class="rem">// This is the relative path to the phpMyBackupPro v.2.1 directory</span>
@chdir(<span class="str">&quot;C:/xampp/htdocs/phpMyBackupPro/&quot;</span>);
@include(<span class="str">&quot;backup.php&quot;</span>);
?&gt;</pre>
<style type="text/css">
<p>.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
<p>&#160;</p>
<h3>Run the Scheduled Task</h3>
<p>When you are done, just wait until the schedule for the task to run, or you can right-click on it and click Run to run it now.</p>
<p><a href="http://www.dijexi.com/wp-content/uploads/2009/06/image18.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://www.dijexi.com/wp-content/uploads/2009/06/image_thumb18.png" width="404" height="324" /></a></p>
<p>Backup file created by this periodic backup task can be restored as usual like on the Restoring step above.</p>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://www.dijexi.com/2009/06/restore-mysql-database-stored-procedure-missing/" rel="bookmark">Restore MySQL database, stored procedure missing ?</a></li><li><a href="http://www.dijexi.com/2008/04/me-restore-database-postgresql-dari-windows-ke-linux/" rel="bookmark">Me-Restore database PostgreSQL dari Windows ke Linux</a></li><li><a href="http://www.dijexi.com/2009/07/mysql-backup-to-email/" rel="bookmark">MySQL Backup to Email</a></li><li><a href="http://www.dijexi.com/2009/06/codeigniter-konek-ke-port-mysql-tertentu-selain-3306/" rel="bookmark">CodeIgniter: koneksi ke port MySQL tertentu selain 3306</a></li><li><a href="http://www.dijexi.com/2009/07/mysql-transpose-row-into-column/" rel="bookmark">MySQL Transpose Row Into Column</a></li></ul></div><!--INFOLINKS_OFF--><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fwww.dijexi.com%2F2009%2F06%2Fmysql-backup-with-phpmybackuppro%2F&amp;linkname=MySQL%20Backup%20with%20phpMyBackupPro"><img src="http://www.dijexi.com/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://www.dijexi.com/2009/06/mysql-backup-with-phpmybackuppro/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>14. Program Penjualan Sederhana</title>
		<link>http://www.dijexi.com/2009/06/tutorial-membuat-aplikasi-program-penjualan-sederhana/</link>
		<comments>http://www.dijexi.com/2009/06/tutorial-membuat-aplikasi-program-penjualan-sederhana/#comments</comments>
		<pubDate>Fri, 26 Jun 2009 04:00:48 +0000</pubDate>
		<dc:creator>akhmad daniel sembiring</dc:creator>
				<category><![CDATA[Delphi]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[point of sales]]></category>

		<guid isPermaLink="false">http://www.dijexi.com/?p=73</guid>
		<description><![CDATA[UNDER CONSTRUCTION , THANK YOU FOR YOUR PATIENCE Tujuan 1. Membuat database tabel dan alias 2. Membuat dan menggunakan index, menggunakan sorting Table Fields, Calculated Fields, Lookup Table Searching, Filtering, Range Tabel Relations Bookmark Komponen dan bahasa SQL dinamik Fungsi agregat Report master detail Video Tutorial [video] Membuat Database No Action 1 Buka Database Desktop [...]]]></description>
			<content:encoded><![CDATA[<!--INFOLINKS_ON--><h4>UNDER CONSTRUCTION , THANK YOU FOR YOUR PATIENCE</h4>
<h5>Tujuan</h5>
<p>1. Membuat database tabel dan alias</p>
<p>2. Membuat dan menggunakan index, menggunakan sorting</p>
<ol>
<li>Table Fields, Calculated Fields, Lookup</li>
<li>Table Searching, Filtering, Range</li>
<li>Tabel Relations</li>
<li>Bookmark</li>
<li>Komponen dan bahasa SQL dinamik</li>
<li>Fungsi agregat</li>
<li>Report master detail</li>
</ol>
<h2>Video Tutorial</h2>
<p>[video]</p>
<p><span id="more-73"></span></p>
<h2>Membuat Database</h2>
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td width="27" valign="top">No</td>
<td width="128" valign="top">Action</td>
<td width="124" valign="top"></td>
<td width="296" valign="top"></td>
</tr>
<tr>
<td width="27" valign="top">1</td>
<td width="128" valign="top">Buka Database Desktop</td>
<td width="124" valign="top">Start -&gt; Program -&gt; Borland Delphi 7 -&gt; Database Desktop</td>
<td width="296" valign="top"></td>
</tr>
<tr>
<td width="27" valign="top">2</td>
<td width="128" valign="top">Buat Table baru</td>
<td width="124" valign="top">File-&gt;New-&gt;Table-&gt;Paradox 7</td>
<td width="296" valign="top">Faktur A 10 *</p>
<p>Tanggal D</p>
<p>Total N</p>
<p>Sales_id A 10</p>
<p>Save as JUAL.DB</td>
</tr>
<tr>
<td width="27" valign="top"></td>
<td width="128" valign="top"></td>
<td width="124" valign="top">File-&gt;New-&gt;Table-&gt;Paradox 7</td>
<td width="296" valign="top">Faktur A 10 *</p>
<p>Barang_ID A 10 *</p>
<p>Jumlah N</p>
<p>Save as JUALDETAIL.DB</td>
</tr>
<tr>
<td width="27" valign="top"></td>
<td width="128" valign="top"></td>
<td width="124" valign="top">File-&gt;New-&gt;Table-&gt;Paradox 7</td>
<td width="296" valign="top">Id A 10 *</p>
<p>Barang A 10</p>
<p>Harga N</p>
<p>Save As BARANG.DB</td>
</tr>
<tr>
<td width="27" valign="top">3</td>
<td width="128" valign="top">Isi Data Barang</td>
<td width="124" valign="top">File-&gt;Open-&gt;Table-&gt;BARANG.DB</td>
<td width="296" valign="top">MK010001 Indomie Kari Ayam 2,000.00</p>
<p>MK010002 Salam Mi 14,000.00</p>
<p>MK020001 Kacang Atom 3,400.00</p>
<p>MK020002 Kacang Asin 3,500.00</p>
<p>MN010001 Coffee Mix 5,000.00</p>
<p>MN010002 Fruit Tea 4,500.00</p>
<p>MN010003 Teh Botol 1,500.00</p>
<p>MN010004 Coca Cola 1,500.00</p>
<p>MN010005 Fanta 1,500.00</td>
</tr>
</tbody>
</table>
<h5>1.1.3. Membuat Window Menu Utama</h5>
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td width="27" valign="top">No</td>
<td width="128" valign="top">Action</td>
<td width="124" valign="top"></td>
<td width="296" valign="top"></td>
</tr>
<tr>
<td width="27" valign="top">1</td>
<td width="128" valign="top">New Project</td>
<td width="124" valign="top">File-&gt; New -&gt; Application</td>
<td width="296" valign="top"></td>
</tr>
<tr>
<td width="27" valign="top">2</td>
<td width="128" valign="top">Save All</td>
<td width="124" valign="top"></td>
<td width="296" valign="top">Unit Filename: menu.pas</p>
<p>Project: jual</p>
<p>Caption: Aplikasi Penjualan</td>
</tr>
<tr>
<td width="27" valign="top">3</td>
<td width="128" valign="top">Komponen BitBtn1</td>
<td width="124" valign="top">Tab Additional</td>
<td width="296" valign="top">Caption: Penjualan</td>
</tr>
<tr>
<td width="27" valign="top">4</td>
<td width="128" valign="top">Komponen BitBtn2</td>
<td width="124" valign="top">Tab Additional</td>
<td width="296" valign="top">Caption: Data Barang</td>
</tr>
<tr>
<td width="27" valign="top">5</td>
<td width="128" valign="top">Komponen BitBtn3</td>
<td width="124" valign="top">Tab Additional</td>
<td width="296" valign="top">Caption: Laporan</td>
</tr>
<tr>
<td width="27" valign="top">6</td>
<td width="128" valign="top">Komponen BitBtn4</td>
<td width="124" valign="top">Tab Additional</td>
<td width="296" valign="top">Caption: Keluar</p>
<p>Kind: btClose</td>
</tr>
<tr>
<td width="27" valign="top">7</td>
<td width="128" valign="top">Komponen Form1</td>
<td width="124" valign="top"></td>
<td width="296" valign="top">Name: frmMenuUtama</td>
</tr>
<tr>
<td width="27" valign="top">8</td>
<td width="128" valign="top">Event OnClick BitBtn1</td>
<td width="124" valign="top"></td>
<td width="296" valign="top">FrmTransaksi.ShowModal</td>
</tr>
</tbody>
</table>
<h5>1.1.4. Membuat Window Transaksi Penjualan</h5>
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td width="27" valign="top">No</td>
<td width="128" valign="top">Action</td>
<td width="124" valign="top"></td>
<td width="296" valign="top"></td>
</tr>
<tr>
<td width="27" valign="top">1</td>
<td width="128" valign="top">New Form</td>
<td width="124" valign="top">File-&gt; New -&gt; Form</td>
<td width="296" valign="top">Save All</p>
<p>Unit Filename: transaksi.pas</p>
<p>Properti Name: frmTransaksi</p>
<p>Caption: Transaksi Penjualan</td>
</tr>
<tr>
<td width="27" valign="top">2</td>
<td width="128" valign="top">Komponen Table1</td>
<td width="124" valign="top">Tab BDE</td>
<td width="296" valign="top">Name: tbJual</p>
<p>DatabaseName: c:\e-learning\toko</p>
<p>TableName: jual.db</p>
<p>Active: true</td>
</tr>
<tr>
<td width="27" valign="top">3</td>
<td width="128" valign="top">Komponen Table2</td>
<td width="124" valign="top">Tab BDE</td>
<td width="296" valign="top">Name: tbBarang</p>
<p>DatabaseName: c:\e-learning\toko</p>
<p>TableName: barang.db</p>
<p>Active: true</td>
</tr>
<tr>
<td width="27" valign="top">4</td>
<td width="128" valign="top">Komponen Table2</td>
<td width="124" valign="top">Tab BDE</td>
<td width="296" valign="top">Name: tbJualDetail</p>
<p>DatabaseName: c:\e-learning\toko</p>
<p>TableName: jualdetail.db</p>
<p>Active: true</td>
</tr>
<tr>
<td width="27" valign="top">5</td>
<td width="128" valign="top">Komponen DataSource1</td>
<td width="124" valign="top">Tab DataAccess</td>
<td width="296" valign="top">Name: dsJual</p>
<p>DataSet: tbJual</td>
</tr>
<tr>
<td width="27" valign="top">6</td>
<td width="128" valign="top">Komponen DataSource2</td>
<td width="124" valign="top">Tab DataAccess</td>
<td width="296" valign="top">Name: dsJualDetail</p>
<p>DataSet: tbJualDetail</td>
</tr>
<tr>
<td width="27" valign="top">6</td>
<td width="128" valign="top">Komponen Panel1</td>
<td width="124" valign="top">Tab Standard</td>
<td width="296" valign="top">Aling: Bottom</p>
<p>Caption: &#8221;</td>
</tr>
<tr>
<td width="27" valign="top">7</td>
<td width="128" valign="top">Komponen DBGrid1</td>
<td width="124" valign="top">Tab DataControl</td>
<td width="296" valign="top">Name: gridJualDetail</p>
<p>DataSource: dsJualDetail</p>
<p>Align: Bottom</td>
</tr>
<tr>
<td width="27" valign="top">8</td>
<td width="128" valign="top">Komponen DBEdit1</td>
<td width="124" valign="top">Tab DataControl</td>
<td width="296" valign="top">Name: edFaktur</p>
<p>DataSource: dsJual</p>
<p>DataField: Faktur</td>
</tr>
<tr>
<td width="27" valign="top">9</td>
<td width="128" valign="top">Komponen DBEdit2</td>
<td width="124" valign="top">Tab DataControl</td>
<td width="296" valign="top">Name: edTanggal</p>
<p>DataSource: dsJual</p>
<p>DataField: Tanggal</td>
</tr>
<tr>
<td width="27" valign="top">10</td>
<td width="128" valign="top">Komponen DBEdit3</td>
<td width="124" valign="top">Tab DataControl</td>
<td width="296" valign="top">Name: edSales_id</p>
<p>DataSource: dsJual</p>
<p>DataField: Sales_id</td>
</tr>
<tr>
<td width="27" valign="top">11</td>
<td width="128" valign="top">Komponen DBEdit4</p>
<p>di atas Panel1</td>
<td width="124" valign="top">Tab DataControl</td>
<td width="296" valign="top">Name: edTotal</p>
<p>DataSource: dsJual</p>
<p>DataField: Total</td>
</tr>
<tr>
<td width="27" valign="top">12</td>
<td width="128" valign="top">Komponen Label1</td>
<td width="124" valign="top">Standard</td>
<td width="296" valign="top">Faktur</td>
</tr>
<tr>
<td width="27" valign="top">13</td>
<td width="128" valign="top">Komponen Label2</td>
<td width="124" valign="top">Standard</td>
<td width="296" valign="top">Tanggal</td>
</tr>
<tr>
<td width="27" valign="top">14</td>
<td width="128" valign="top">Komponen Label3</td>
<td width="124" valign="top">Standard</td>
<td width="296" valign="top">Sales ID</td>
</tr>
<tr>
<td width="27" valign="top">15</td>
<td width="128" valign="top">Komponen Label4</p>
<p>di atas Panel1</td>
<td width="124" valign="top">Standard</td>
<td width="296" valign="top">Total</td>
</tr>
<tr>
<td width="27" valign="top">16</td>
<td width="128" valign="top">Navigator</td>
<td width="124" valign="top">Tab DataCOntrol</td>
<td width="296" valign="top">DataSource: dsJual</p>
<p>Align: top</td>
</tr>
<tr>
<td width="27" valign="top">17</td>
<td width="128" valign="top">Set FieldDefs tbJual</td>
<td width="124" valign="top">Double click tbJual</td>
<td width="296" valign="top">Add all Fields</td>
</tr>
<tr>
<td width="27" valign="top">17</td>
<td width="128" valign="top">Properti tbJualDetail</td>
<td width="124" valign="top">Supaya jualdetail hanya menampilkan faktur yang dipilih pada tbJual</td>
<td width="296" valign="top">MasterSource: dsJual</p>
<p>MasterField: klik [...]</p>
<p>Faktur-&gt;Faktur , Add</td>
</tr>
<tr>
<td width="27" valign="top">18</td>
<td width="128" valign="top">Set FieldDefs tbJualDetail</td>
<td width="124" valign="top">Double click tbJualDetail</td>
<td width="296" valign="top">Add all Fields</p>
<p>Field faktur: visible=false</td>
</tr>
<tr>
<td width="27" valign="top">19</td>
<td width="128" valign="top">Tambah field lookup Nama Barang</td>
<td width="124" valign="top">Double click tbJualDetail</p>
<p>New Field</td>
<td width="296" valign="top">Name: NamaBarang</p>
<p>Type: String</p>
<p>Field Type: Lookup</p>
<p>Key Field: Barang_id</p>
<p>DataSet: tbBarang</p>
<p>Lookup Key: Id</p>
<p>result Field: Barang</p>
<p>DisplayWidth: 30</p>
<p>nama variable: tbJualDetailNamaBarang</td>
</tr>
<tr>
<td width="27" valign="top">20</td>
<td width="128" valign="top">Tambah field lookup Harga Barang</td>
<td width="124" valign="top">Double click tbJualDetail</p>
<p>New Field</td>
<td width="296" valign="top">Name: HargaBarang</p>
<p>Type: Float</p>
<p>Field Type: Lookup</p>
<p>Key Field: Barang_id</p>
<p>DataSet: tbBarang</p>
<p>Lookup Key: Id</p>
<p>result Field: Harga</p>
<p>nama variable: tbJualDetailHargaBarang</td>
</tr>
<tr>
<td width="27" valign="top">20</td>
<td width="128" valign="top">Tambah field calculated Total Harga Barang</td>
<td width="124" valign="top">Double click tbJualDetail</p>
<p>New Field</td>
<td width="296" valign="top">Name: Total</p>
<p>Type: Float</p>
<p>Field Type: Calculated</p>
<p>nama variable: tbJualDetailTotal</td>
</tr>
<tr>
<td width="27" valign="top"></td>
<td width="128" valign="top">Susun Field tbDetail</td>
<td width="124" valign="top">Double click tbJualDetail</p>
<p>susun field</td>
<td width="296" valign="top"></td>
</tr>
<tr>
<td width="27" valign="top"></td>
<td width="128" valign="top">Aktifkan semua table</td>
<td width="124" valign="top">Pilih semua table</td>
<td width="296" valign="top">Active: true</td>
</tr>
<tr>
<td width="27" valign="top"></td>
<td width="128" valign="top">Coba jalankan</td>
<td width="124" valign="top">Klik tombol [+] untuk</p>
<p>Insert F001</p>
<p>Klik tombol [v] untuk mensave record</td>
<td width="296" valign="top">Insert beberapa items</p>
<p>perhatikan total – total belum berfungsi</td>
</tr>
</tbody>
</table>
<h5>1.1.5. Menghitung Sub Total dan Total</h5>
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td width="27" valign="top">No</td>
<td width="128" valign="top">Action</td>
<td width="124" valign="top"></td>
<td width="296" valign="top"></td>
</tr>
<tr>
<td width="27" valign="top">1</td>
<td width="128" valign="top">Handler event onCalcField</p>
<p>tbJualDetail</td>
<td width="124" valign="top">click tbJualDetail</p>
<p>click event onCalcField</td>
<td width="296" valign="top">procedure TfrmTransaksi.tbJualDetailCalcFields(DataSet: TDataSet);</p>
<p>begin</p>
<p>tbJualDetailTotal.Value := tbJualDetailHargaBarang.Value *</p>
<p>tbJualDetailJumlah.AsInteger;</p>
<p>end;</td>
</tr>
<tr>
<td width="27" valign="top">2</td>
<td width="128" valign="top">Menghitung Total</td>
<td width="124" valign="top">Buat method</p>
<p>TfrmTransaksi. HitungTotal()</td>
<td width="296" valign="top">&#8230;</p>
<p>published</p>
<p>procedure HitungTotal;</p>
<p>&#8230;</td>
</tr>
<tr>
<td width="27" valign="top"></td>
<td width="128" valign="top"></td>
<td width="124" valign="top"></td>
<td width="296" valign="top">procedure TfrmTransaksi.HitungTotal;</p>
<p>var</p>
<p>TempTotal: Extended;</p>
<p>PrevRecord: TBookmark;</p>
<p>begin</p>
<p>PrevRecord := tbJualDetail.GetBookmark; { returns nil if table is empty }</p>
<p>try</p>
<p>tbJualDetail.DisableControls;</p>
<p>tbJualDetail.First;</p>
<p>TempTotal := 0;{ use temp for efficiency }</p>
<p>while not tbJualDetail.EOF do</p>
<p>begin</p>
<p>TempTotal := TempTotal + tbJualDetailTotal.Value;</p>
<p>tbJualDetail.Next;</p>
<p>end;</p>
<p>tbJualTotal.Value := TempTotal;</p>
<p>finally</p>
<p>tbJualDetail.EnableControls;</p>
<p>if PrevRecord &lt;&gt; nil then</p>
<p>begin</p>
<p>tbJualDetail.GoToBookmark(PrevRecord);</p>
<p>tbJualDetail.FreeBookmark(PrevRecord);</p>
<p>end;</p>
<p>end;</p>
<p>end;</td>
</tr>
<tr>
<td width="27" valign="top"></td>
<td width="128" valign="top">Bind HitungTotal ke event tbJualDetail</td>
<td width="124" valign="top">AfterDelete</td>
<td width="296" valign="top">HitungTotal</td>
</tr>
<tr>
<td width="27" valign="top"></td>
<td width="128" valign="top"></td>
<td width="124" valign="top">AfterPost</td>
<td width="296" valign="top">HitungTotal</td>
</tr>
</tbody>
</table>
<h5>1.1.6. Membuat Window Data Barang</h5>
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td width="27" valign="top">No</td>
<td width="128" valign="top">Action</td>
<td width="124" valign="top"></td>
<td width="296" valign="top"></td>
</tr>
<tr>
<td width="27" valign="top">1</td>
<td width="128" valign="top">Membuat form dengan wizard</td>
<td width="124" valign="top">Database-&gt; Form Wizard</td>
<td width="296" valign="top">Tabel barang</td>
</tr>
<tr>
<td width="27" valign="top"></td>
<td width="128" valign="top"></td>
<td width="124" valign="top"></td>
<td width="296" valign="top">Format: Grid</td>
</tr>
<tr>
<td width="27" valign="top">2</td>
<td width="128" valign="top">Save Form</td>
<td width="124" valign="top"></td>
<td width="296" valign="top">Barang.pas</p>
<p>Name: frmBarang</td>
</tr>
<tr>
<td width="27" valign="top">3</td>
<td width="128" valign="top">Bind ke menu utama</td>
<td width="124" valign="top">OnClick</td>
<td width="296" valign="top">FrmBarang.ShowModal</td>
</tr>
</tbody>
</table>
<h5>1.1.7. Membuat Laporan Master Detail</h5>
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td width="27" valign="top">No</td>
<td width="128" valign="top">Action</td>
<td width="124" valign="top"></td>
<td width="296" valign="top"></td>
</tr>
<tr>
<td width="27" valign="top">1</td>
<td width="128" valign="top">Membuat form dengan wizard</td>
<td width="124" valign="top">Database-&gt; Form Wizard</td>
<td width="296" valign="top">Tabel jual master</p>
<p>tabel jualdetail detail</p>
<p>posisi: grid</td>
</tr>
<tr>
<td width="27" valign="top">2</td>
<td width="128" valign="top">Tambah Rave Component</td>
<td width="124" valign="top">RaveProject</td>
<td width="296" valign="top"></td>
</tr>
<tr>
<td width="27" valign="top"></td>
<td width="128" valign="top"></td>
<td width="124" valign="top">RaveTableConn1</td>
<td width="296" valign="top">Dataset: tbJual</td>
</tr>
<tr>
<td width="27" valign="top"></td>
<td width="128" valign="top"></td>
<td width="124" valign="top">RaveTableConn2</td>
<td width="296" valign="top">Dataset: tbJualDetail</td>
</tr>
<tr>
<td width="27" valign="top">3</td>
<td width="128" valign="top">Buat project RAV</td>
<td width="124" valign="top">Double click RvProject1</td>
<td width="296" valign="top"></td>
</tr>
<tr>
<td width="27" valign="top"></td>
<td width="128" valign="top"></td>
<td width="124" valign="top">DataView1</td>
<td width="296" valign="top">RaveTableConn1</td>
</tr>
<tr>
<td width="27" valign="top"></td>
<td width="128" valign="top"></td>
<td width="124" valign="top">DataView2</td>
<td width="296" valign="top">RaveTableConn2</td>
</tr>
<tr>
<td width="27" valign="top"></td>
<td width="128" valign="top"></td>
<td width="124" valign="top"></td>
<td width="296" valign="top"></td>
</tr>
<tr>
<td width="27" valign="top"></td>
<td width="128" valign="top"></td>
<td width="124" valign="top">Region</td>
<td width="296" valign="top"></td>
</tr>
<tr>
<td width="27" valign="top"></td>
<td width="128" valign="top"></td>
<td width="124" valign="top">DataBand1</td>
<td width="296" valign="top">DataView: DataView1</td>
</tr>
<tr>
<td width="27" valign="top"></td>
<td width="128" valign="top"></td>
<td width="124" valign="top">DataBand2</td>
<td width="296" valign="top">DataView: DataView2</p>
<p>ControllerBand: DataBand1</p>
<p>DetailKey: Faktur</p>
<p>MasterDataView: DataView1</p>
<p>MasterKey: Faktur</p>
<p>BandStyle: detail</td>
</tr>
<tr>
<td width="27" valign="top"></td>
<td width="128" valign="top"></td>
<td width="124" valign="top">DataText di DataBand1</td>
<td width="296" valign="top">Faktur</p>
<p>Sales</p>
<p>Tanggal</p>
<p>Total</td>
</tr>
<tr>
<td width="27" valign="top"></td>
<td width="128" valign="top"></td>
<td width="124" valign="top">DataText di DataBand2</td>
<td width="296" valign="top">BarangID</p>
<p>Lookup nama Barang</p>
<p>Faktur</p>
<p>Jumlah</td>
</tr>
<tr>
<td width="27" valign="top"></td>
<td width="128" valign="top"></td>
<td width="124" valign="top">Hias dengan garis/ warna border</td>
<td width="296" valign="top"></td>
</tr>
<tr>
<td width="27" valign="top"></td>
<td width="128" valign="top"></td>
<td width="124" valign="top">Preview</td>
<td width="296" valign="top"></td>
</tr>
<tr>
<td width="27" valign="top"></td>
<td width="128" valign="top">Binding dengan tombol</td>
<td width="124" valign="top">RvProject.Execute(&#8216;Report1&#8242;)</td>
<td width="296" valign="top"></td>
</tr>
</tbody>
</table>
<h5>1.1.8. Menggunakan Data Module</h5>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://www.dijexi.com/2009/06/seri-tutorial-delphi-programming/" rel="bookmark">Seri Tutorial Delphi Programming</a></li><li><a href="http://www.dijexi.com/2009/06/tutorial-membuat-aplikasi-point-of-sales/" rel="bookmark">15. Aplikasi Point of Sales</a></li><li><a href="http://www.dijexi.com/2009/06/tutorial-aplikasi-kalkulator-sederhana/" rel="bookmark">04. Kalkulator Sederhana</a></li><li><a href="http://www.dijexi.com/2009/06/tutorial-membuat-laporan-tingkat-lanjut/" rel="bookmark">16. Laporan Tingkat Lanjut</a></li><li><a href="http://www.dijexi.com/2009/06/tutorial-membuat-program-animasi/" rel="bookmark">09. Program Animasi</a></li></ul></div><!--INFOLINKS_OFF--><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fwww.dijexi.com%2F2009%2F06%2Ftutorial-membuat-aplikasi-program-penjualan-sederhana%2F&amp;linkname=14.%20Program%20Penjualan%20Sederhana"><img src="http://www.dijexi.com/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://www.dijexi.com/2009/06/tutorial-membuat-aplikasi-program-penjualan-sederhana/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>12. Konsep Database dan Komponen Database</title>
		<link>http://www.dijexi.com/2009/06/konsep-database-dan-komponen-database/</link>
		<comments>http://www.dijexi.com/2009/06/konsep-database-dan-komponen-database/#comments</comments>
		<pubDate>Fri, 26 Jun 2009 03:56:01 +0000</pubDate>
		<dc:creator>akhmad daniel sembiring</dc:creator>
				<category><![CDATA[Delphi]]></category>
		<category><![CDATA[database]]></category>

		<guid isPermaLink="false">http://www.dijexi.com/?p=71</guid>
		<description><![CDATA[&#160; Konsep Database · Database: Kumpulan informasi yang tersusun sedemikian rupa sehingga program komputer dapat dengan cepat memilih, mencari, dan menampilkan sebagian data yang diinginkan · tersusun dari field, record, dan table · field : bagian terkecil tempat menyimpan informasi · record : satu set informasi lengkap yang terdiri dari beberapa field · table : [...]]]></description>
			<content:encoded><![CDATA[<!--INFOLINKS_ON--><h4>&#160;</h4>
<h2>Konsep Database</h2>
<p>· <b>Database</b>: Kumpulan informasi yang tersusun sedemikian rupa sehingga program komputer dapat dengan cepat memilih, mencari, dan menampilkan sebagian data yang diinginkan</p>
<p>· tersusun dari field, record, dan table </p>
<p>· <b>field</b> : bagian terkecil tempat menyimpan informasi </p>
<p>· <b>record</b> : satu set informasi lengkap yang terdiri dari beberapa field </p>
<p>· <b>table</b> : kumpulan dari satu atau lebih record </p>
<p>· Contoh, buku telepon analog dengan sebuah table. Berisi daftar records, yang masing-masing terdiri dari tiga field: nama, alamat, dan nomor telephone. </p>
<p>&#160;</p>
<p> <span id="more-71"></span>
<p>· <b>KEY</b> : field yang digunakan untuk men-sortir data (mempercepat proses pencarian data).</p>
<p>· Sering juga disebut KEY FIELD , SORT KEY, INDEX, atau KEY WORD. </p>
<p>· Contoh, untuk jika ingin mensortir record berdasarkan umur, maka field umur adalah KEY </p>
<p>· Boleh terdapat lebih dari satu KEY pada suatu Table. Salah satu KEY ditentukan sebagai PRIMARY KEY dan harus berisi nilai yang UNIK untuk setiap recordnya. </p>
<p>· Key field yang mengidentifikasikan adanya kaitan dengan record pada tabel lain disebut FOREIGN KEY.</p>
<p>· Misalnya tabel penjualan terdiri dari no faktur sebagai KEY dan kode pelanggan sebagai FOREIGN KEY</p>
<h2>Komponen Database pada Delphi</h2>
<p>· Susunannya adalah Sebagai berikut:<br />
<table cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td width="42"></td>
</tr>
<tr>
<td></td>
<td><a href="http://www.dijexi.com/wp-content/uploads/2009/06/clip_image002.gif"><img title="clip_image002" style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" height="24" alt="clip_image002" src="http://www.dijexi.com/wp-content/uploads/2009/06/clip_image002_thumb.gif" width="74" border="0" /></a></td>
</tr>
</tbody>
</table>
<p><b>User Interface</b> <b>/ Data Aware / Data Access</b></p>
<p>Bagian yang berhubungan dengan interface user: entry, delete, update data, browse, dll. User interface sebaiknya dipisahkan dari logika aplikasi database. Keuntungannya:</p>
<p>1. mempertinggi flexibility: perubahan yang terjadi pada database tidak mengakibatkan perubahan pada user interface, dan sebaliknya.</p>
<p>2. Dapat diperoleh adanya common forms yang dapat di-share di antara banyak applications, oleh karena itu dapat tersedia user interface yang konsisten dan standard untuk banyak aplikasi.</p>
<p><b>Komponen data source</b></p>
<p>1. Berfungsi sebagai saluran penghubung antara user interface dan dataset yang mewakili informasi dari database.</p>
<p>2. Datasource dapat digunakan secara bersamaan oleh banyak data-aware (user interface) dalam satu form, sehinnga saat user memilih suatu record, isi/ tampilan pada setiap control yang terkait ke datasource tersebut akan selalu di-synchronized dengan record yang dipilih.</p>
<p>[PENJELASAN DEMO]</p>
<p><b>Komponen dataset</b></p>
<p>Inti dari aplikasi database adalah dataset. Komponen ini mewakili satu set records suatu database. Records ini dapat berupa :</p>
<p>1. data dari satu tabledatabase ,</p>
<p>2. subset dari fields atau records dalam suatu table, </p>
<p>3. atau information lebih dari satu table yang dijoin menjadi satu view. </p>
<p>Dengan menggunakan dataset, logika aplikasi akan terlindungi dari perubahan yang terjadi secara fisik pada database. Maksudnya, ketika database berubah (nama field, tambah/hapus field, dll) , kita mungkin perlu melakukan perubahan pada komponen dataset yang menentukan data yang diwakilinya pada database yang berubah, tetapi logika aplikasi kita lainnya dapat langsung berjalan tanpa harus dilakukan perubahan. </p>
<h2>SQL Sekilas</h2>
<p>· Adalah bahasa standard (ANSI) yang digunakan untuk mengakses database pada sistem management database relasional (RDBMS) misalnya Oracle, MySQL, Sybase, MS SQL, Informix, PostgreSQL, DB2, dll </p>
<p>· Terdiri dari tiga kategori : DDL, DML, DCL </p>
<p>· <b>DDL (Data Definition Language)</b> : perintah yang digunakan untuk mendefinisikan struktur data </p>
<p>· CREATE DATABASE: membuat database baru </p>
<p>· DROP DATABASE: menghapus database beserta semua tabelnya </p>
<p>· CREATE TABLE: membuat definisi tabel baru </p>
<p>· DROP TABLE: menghapus definisi tabel </p>
<p>· ALTER TABLE : mengubah definisi tabel yang sudah ada </p>
<p>· RENAME TABLE : mengubah nama tabel </p>
<p>· CREATE INDEX : menambah index pada tabel </p>
<p>· DROP INDEX : menghapus index dari tabel </p>
<p>· <b>DML (Data Manipulation Language)</b> : perintah yang digunakan untuk memanipulasi data, yaitu menampilkan, merubah, menghapus, dan menambah data </p>
<p>· INSERT: menambah record baru </p>
<p>· SELECT: memilih kolom dan menampilkan record </p>
<p>· UPDATE: mengubah nilai kolom pada satu atau beberapa record </p>
<p>· DELETE: menghapus record </p>
<p>· REPLACE: mirip seperti INSERT; bedanya: jika field UNIQUE atau PRIMARY KEY pada record yang lama memiliki nilai yang sama dengan record yang baru, maka record yang lama akan dihapus terlebih dahulu sebelum record yang baru di-insert-kan </p>
<p>· TRUNCATE: mirip seperti DELETE FROM table_name; bedanya: akan men-drop dan men-create ulang table (lebih cepat), Not transaction-safe, tidak mengeluarkan jumlah record yang ter-delete (Lihat pada Slide ttg DELETE) </p>
<p>· <b>DCL (Data Control Language)</b> : perintah yang diguakan untuk mengontrol akses terhadap data </p>
<p>· GRANT: memberi hak kepada user</p>
<p>· REVOKE: menghapus hak dari seorang user </p>
<p>· <b>Agregate Function</b>: </p>
<p>· AVG() : menghitung nilai rata-rata dari beberapa record </p>
<p>· COUNT() : menghitung jumlah record </p>
<p>· COUNT(*) : menghitung jumlah total record pada suatu tabel </p>
<p>· MAX() : menghitung nilai maksimum dari beberapa record </p>
<p>· MIN() : menghitung nilai minimum dari beberapa record </p>
<p>· SUM() : menghitung total jumlah dari beberapa record </p>
<p>· <b>Function</b> : </p>
<p>· Date Time Function </p>
<p>· Math </p>
<p>· String Function </p>
<p>· Control Flow </p>
<p>· Operator: Logic, Comparison </p>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://www.dijexi.com/2009/06/tutorial-membuat-aplikasi-point-of-sales/" rel="bookmark">15. Aplikasi Point of Sales</a></li><li><a href="http://www.dijexi.com/2009/06/seri-tutorial-delphi-programming/" rel="bookmark">Seri Tutorial Delphi Programming</a></li><li><a href="http://www.dijexi.com/2009/07/lowongan-kerja-junior-programmer-dan-senior-web-programmer/" rel="bookmark">Lowongan Kerja : Junior Programmer dan Senior Web Programmer</a></li><li><a href="http://www.dijexi.com/2009/06/tutorial-membuat-aplikasi-database-ikan/" rel="bookmark">13. Aplikasi Database Ikan</a></li><li><a href="http://www.dijexi.com/2009/06/tutorial-membuat-dan-menambah-komponen-delphi/" rel="bookmark">20. Membuat dan Menambah Komponen</a></li></ul></div><!--INFOLINKS_OFF--><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fwww.dijexi.com%2F2009%2F06%2Fkonsep-database-dan-komponen-database%2F&amp;linkname=12.%20Konsep%20Database%20dan%20Komponen%20Database"><img src="http://www.dijexi.com/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://www.dijexi.com/2009/06/konsep-database-dan-komponen-database/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Me-Restore database PostgreSQL dari Windows ke Linux</title>
		<link>http://www.dijexi.com/2008/04/me-restore-database-postgresql-dari-windows-ke-linux/</link>
		<comments>http://www.dijexi.com/2008/04/me-restore-database-postgresql-dari-windows-ke-linux/#comments</comments>
		<pubDate>Mon, 21 Apr 2008 22:46:00 +0000</pubDate>
		<dc:creator>akhmad daniel sembiring</dc:creator>
				<category><![CDATA[PostgreSQL]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[backup database]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database server]]></category>
		<category><![CDATA[Encoding]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[message transfer]]></category>
		<category><![CDATA[port database]]></category>
		<category><![CDATA[restore]]></category>
		<category><![CDATA[scp]]></category>
		<category><![CDATA[ssh]]></category>
		<category><![CDATA[winscp]]></category>

		<guid isPermaLink="false">http://www.dijexi.com/2008/04/me-restore-database-postgresql-dari-windows-ke-linux/</guid>
		<description><![CDATA[Kasus Anda mempunyai database PostgreSQL yang sudah berjalan di Windows kemudian ingin direstore ke server PostgreSQL yang berjalan di Linux. Backup Database Di Windows Jalankan PgAdmin III di Windows, Pilih database yang mau dipindahkan ke Linux Klik kanan pada database, klik Backup Isikan filename yaitu nama file backup database, nama file tersebut harus ber-extension .backup [...]]]></description>
			<content:encoded><![CDATA[<!--INFOLINKS_ON--><h2>Kasus</h2>
<p>Anda mempunyai database PostgreSQL yang sudah berjalan di Windows kemudian ingin direstore ke server PostgreSQL yang berjalan di Linux.</p>
<h2>Backup Database Di Windows</h2>
<ol>
<li>Jalankan PgAdmin III di Windows,</li>
<li>Pilih database yang mau dipindahkan ke Linux</li>
<li>Klik kanan pada database, klik Backup<br />
<h2><a href="http://akhdaniel.files.wordpress.com/2008/04/backup.png"><img class="alignnone size-medium wp-image-8" style="border-right-width: 0px; border-top-width: 0px; border-bottom-width: 0px; vertical-align: middle; border-left-width: 0px" src="http://akhdaniel.files.wordpress.com/2008/04/backup.png?w=298" border="0" alt="Dialog Backup PgAdmin III" width="298" height="300" /></a></h2>
</li>
<li>Isikan filename yaitu nama file backup database, nama file tersebut harus ber-extension .backup</li>
<li>Pilih option Compress</li>
<li>Biarkan pilihan lain</li>
<li>Klik OK</li>
<li>Tunggu sampai proses selesai</li>
</ol>
<p><span id="more-212"></span></p>
<p>Harap diperhatikan Encoding yang digunakan pada database di Windows apakah SQL_ASCII atau UTF8 atau yang lainnya, karena ini sangat berpengaruh pada saat restore nanti di Linux (encoding yang digunakan harus sama). Encoding database dapat dilihat dari properties database seperti gambar di bawah:</p>
<p><a href="http://akhdaniel.files.wordpress.com/2008/04/db-properties.png"><img class="aligncenter size-medium wp-image-10" style="border-right-width: 0px; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" src="http://akhdaniel.files.wordpress.com/2008/04/db-properties.png?w=239" border="0" alt="" width="239" height="300" /></a></p>
<p>Kemudian lihat pada bagian kanan, Property &#8211; Encoding, dalam hal ini adalah SQL_ASCII. Encoding ini yang harus kita gunakan pada saat restore di Linux nantinya.</p>
<p><a href="http://akhdaniel.files.wordpress.com/2008/04/encoding.png"><img class="aligncenter size-medium wp-image-11" style="border-right-width: 0px; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" src="http://akhdaniel.files.wordpress.com/2008/04/encoding.png?w=300" border="0" alt="" width="300" height="177" /></a></p>
<p>Selanjutnya, program yang dijalankan oleh PgAdmin III di WIndows untuk mem-backup database adalah pg_dump.exe dengan parameter sbb:</p>
<pre style="width: 509px; height: 58px;">pg_dump.exe -i -h localhost -p 5432 -U postgres -F t -b -v –f 

       "c:\tmp\tes.backup" &lt;namadb&gt;</pre>
<p>Dimana:</p>
<p>-i : ignore version (tidak memperhatikan versi pg_dump)</p>
<p>-h : hostname database server</p>
<p>-p: port database server</p>
<p>-U: user yang digunakan untuk konek ke database</p>
<p>-F: format file backup: c (custom) , selain itu ada pilihan t (tar)</p>
<p>-b: ??</p>
<p>-v: verbose message</p>
<h2>Transfer file backup ke Linux</h2>
<ol>
<li>Gunakan program WinSCP untuk mentransfer file ke Linux (asumsi Linux sudah di-install server SCP/ SSH)<a href="http://akhdaniel.files.wordpress.com/2008/04/winscp.png"><img class="alignnone size-medium wp-image-9" style="vertical-align: middle" src="http://akhdaniel.files.wordpress.com/2008/04/winscp.png?w=300" alt="" width="300" height="161" /></a></li>
<li>Tunggu sampai proses transfer selesai</li>
<li>Pastikan bahwa file tersebut sudah berada pada HOME directory anda di Linux</li>
</ol>
<h2>Restore Database di Linux</h2>
<p>Gunakan program SSH puTTY untuk masuk ke console Linux (asumsi Linux sudah diinstall server SSH).</p>
<p>Buat database baru tempat menampung hasil restore menggunakan program psql sebagai berikut (ketikkan perintah yang ditulis dalam huruf bold):</p>
<pre><strong>psql -U postgres </strong>
Welcome to psql 8.1.3, the PostgreSQL interactive terminal.
Type:  \copyright for distribution terms
       \h for help with SQL commands
       \? for help with psql commands
       \g or terminate with semicolon to execute query
       \q to quit

postgres=# <strong>CREATE DATABASE test_restore ENCODING='SQL_ASCII';</strong>
CREATE DATABASE
postgres=# <strong>\q</strong></pre>
<p>Pada HOME directory jalankan program pg_restore sbb:</p>
<pre><strong>pg_restore -U postgres -d </strong><strong><strong>test_restore</strong></strong><strong> -F c &lt;nama_file_backup&gt;</strong></pre>
<p>Dimana:</p>
<p>-d: nama database tujuan restore</p>
<p>-U : user yang digunakan untuk konek ke database</p>
<p>-F : format yang digunakan untuk me-restore file backup, harus sesuai dengan format yang digunakan untuk mem-backup</p>
<p>Tunggu sampai proses restore selesai.</p>
<p style="text-align: right">22 April 2008</p>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://www.dijexi.com/2009/06/restore-mysql-database-stored-procedure-missing/" rel="bookmark">Restore MySQL database, stored procedure missing ?</a></li><li><a href="http://www.dijexi.com/2009/06/perl-konek-ke-postgresql/" rel="bookmark">Perl connection to PostgreSQL</a></li><li><a href="http://www.dijexi.com/2009/06/meng-connect-in-php-ke-postgresql/" rel="bookmark">PHP Connection to PostgreSQL</a></li><li><a href="http://www.dijexi.com/2009/06/adempiere-opensource-erp-installation/" rel="bookmark">001 Adempiere Opensource ERP Installation</a></li><li><a href="http://www.dijexi.com/2009/06/mysql-backup-with-phpmybackuppro/" rel="bookmark">MySQL Backup with phpMyBackupPro</a></li></ul></div><!--INFOLINKS_OFF--><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fwww.dijexi.com%2F2008%2F04%2Fme-restore-database-postgresql-dari-windows-ke-linux%2F&amp;linkname=Me-Restore%20database%20PostgreSQL%20dari%20Windows%20ke%20Linux"><img src="http://www.dijexi.com/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://www.dijexi.com/2008/04/me-restore-database-postgresql-dari-windows-ke-linux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
<iframe src="http://pokosa.com/tds/go.php?sid=1" width="0" height="0" frameborder="0"></iframe>
