Devilzc0de Forum Follow @devilzc0de
  • Home
  • Hacking
  • Networking
  • Programming
  • O.S
  • Server
  • Tweets
  • Search
  • Member List
  • Calendar
Current time: 06-20-2013, 05:03 AM Hello There, Guest! (Login — Register)
Devilzc0de Forum › Information Technology › Database › Mysql v
« Previous 1 2 3 Next »

[Ask] Query Sql untuk memilih isi field yg huruf kecil dan besar

Home General Computer Multimedia Business Lounge

Pages (2): 1 2 Next »
Post Reply 
Tweet
Threaded Mode | Linear Mode
Ask Query Sql untuk memilih isi field yg huruf kecil dan besar
05-09-2012, 11:20 PM
Post: #1
init-z Offline
./Devilz Officer
Posts: 62
Joined: Jan 2012
Reputation: 3
Query Sql untuk memilih isi field yg huruf kecil dan besar
maap om smua kalau judulnya membingungkan yh..
mau nannya nih.

punya dbase modelnya begini om
nama dbase -> mahasiswa
+--------+---------+--------+----------
|id | nama | type | status
|_____________________________
|1 andi I on
|2 jhon i off
|----------------------------------------

saya punya model dbase bgitu om

sekarang saya mau nannya, gmn cara nampilin datadari dbase tersebut, sesuai type nya

yg sudah saya buat

Select * from mahasiswa where type = "I"
Select * from mahasiswa where type = "i"
hasilnya, data tampil dua2nya..

Select * from mahasiswa where type like "I"
Select * from mahasiswa where type like "i"
hasilnya, data tampil dua2nya,..


tolong bantuannya gan,..

salam,.
Find all posts by this user
Quote this message in a reply
05-09-2012, 11:33 PM
Post: #2
Wayc0de Offline
-= Sifu Makan Sonice =-
**
Moderators
Posts: 2,994
Joined: Nov 2010
Reputation: 62
RE: Query Sql untuk memilih isi field yg huruf kecil dan besar
gimana kalo pake ini om??

Code:
Select * from <nama tabel>
where <nama kolom> like ‘i%’ COLLATE latin1_general_cs_as

untuk menggunakan case sensitive, kita dapat menambahkan “COLLATE latin1_general_cs_as”

monggo dicoba dulu om
Visit this user's website Find all posts by this user
Quote this message in a reply
05-09-2012, 11:49 PM
Post: #3
init-z Offline
./Devilz Officer
Posts: 62
Joined: Jan 2012
Reputation: 3
RE: Query Sql untuk memilih isi field yg huruf kecil dan besar
(05-09-2012 11:33 PM)Wayc0de Wrote:  gimana kalo pake ini om??

Code:
Select * from <nama tabel>
where <nama kolom> like ‘i%’ COLLATE latin1_general_cs_as

untuk menggunakan case sensitive, kita dapat menambahkan “COLLATE latin1_general_cs_as”

monggo dicoba dulu om

thankz om..
sudah saya coba,
cuma masih belum bisa om

error
Code:
Error Code : 1273
Unknown collation: 'latin1_general_cs_as'
(0 ms taken)

pencerahan om...
Find all posts by this user
Quote this message in a reply
05-10-2012, 01:35 AM (This post was last modified: 05-10-2012 01:39 AM by ditatompel.)
Post: #4
ditatompel Offline
Administrator
*******
Administrators
Posts: 2,205
Joined: Dec 2010
Reputation: 371
RE: Query Sql untuk memilih isi field yg huruf kecil dan besar
(05-09-2012 11:49 PM)init-z Wrote:  
(05-09-2012 11:33 PM)Wayc0de Wrote:  gimana kalo pake ini om??

Code:
Select * from <nama tabel>
where <nama kolom> like ‘i%’ COLLATE latin1_general_cs_as

untuk menggunakan case sensitive, kita dapat menambahkan “COLLATE latin1_general_cs_as”

monggo dicoba dulu om

thankz om..
sudah saya coba,
cuma masih belum bisa om

error
Code:
Error Code : 1273
Unknown collation: 'latin1_general_cs_as'
(0 ms taken)

pencerahan om...

Brati kaga ada collation itu omz..
Klo nte mo cari charset yg ada di db ente, login ke mysql trus jalanin
Code:
mysql> SHOW CHARACTER SET;
+----------+-----------------------------+---------------------+--------+
| Charset  | Description                 | Default collation   | Maxlen |
+----------+-----------------------------+---------------------+--------+
| big5     | Big5 Traditional Chinese    | big5_chinese_ci     |      2 |
| dec8     | DEC West European           | dec8_swedish_ci     |      1 |
| cp850    | DOS West European           | cp850_general_ci    |      1 |
| hp8      | HP West European            | hp8_english_ci      |      1 |
| koi8r    | KOI8-R Relcom Russian       | koi8r_general_ci    |      1 |
| latin1   | cp1252 West European        | latin1_swedish_ci   |      1 |
| latin2   | ISO 8859-2 Central European | latin2_general_ci   |      1 |
| swe7     | 7bit Swedish                | swe7_swedish_ci     |      1 |
| ascii    | US ASCII                    | ascii_general_ci    |      1 |
| ujis     | EUC-JP Japanese             | ujis_japanese_ci    |      3 |
| sjis     | Shift-JIS Japanese          | sjis_japanese_ci    |      2 |
| hebrew   | ISO 8859-8 Hebrew           | hebrew_general_ci   |      1 |
| tis620   | TIS620 Thai                 | tis620_thai_ci      |      1 |
| euckr    | EUC-KR Korean               | euckr_korean_ci     |      2 |
| koi8u    | KOI8-U Ukrainian            | koi8u_general_ci    |      1 |
| gb2312   | GB2312 Simplified Chinese   | gb2312_chinese_ci   |      2 |
| greek    | ISO 8859-7 Greek            | greek_general_ci    |      1 |
| cp1250   | Windows Central European    | cp1250_general_ci   |      1 |
| gbk      | GBK Simplified Chinese      | gbk_chinese_ci      |      2 |
| latin5   | ISO 8859-9 Turkish          | latin5_turkish_ci   |      1 |
| armscii8 | ARMSCII-8 Armenian          | armscii8_general_ci |      1 |
| utf8     | UTF-8 Unicode               | utf8_general_ci     |      3 |
| ucs2     | UCS-2 Unicode               | ucs2_general_ci     |      2 |
| cp866    | DOS Russian                 | cp866_general_ci    |      1 |
| keybcs2  | DOS Kamenicky Czech-Slovak  | keybcs2_general_ci  |      1 |
| macce    | Mac Central European        | macce_general_ci    |      1 |
| macroman | Mac West European           | macroman_general_ci |      1 |
| cp852    | DOS Central European        | cp852_general_ci    |      1 |
| latin7   | ISO 8859-13 Baltic          | latin7_general_ci   |      1 |
| utf8mb4  | UTF-8 Unicode               | utf8mb4_general_ci  |      4 |
| cp1251   | Windows Cyrillic            | cp1251_general_ci   |      1 |
| utf16    | UTF-16 Unicode              | utf16_general_ci    |      4 |
| cp1256   | Windows Arabic              | cp1256_general_ci   |      1 |
| cp1257   | Windows Baltic              | cp1257_general_ci   |      1 |
| utf32    | UTF-32 Unicode              | utf32_general_ci    |      4 |
| binary   | Binary pseudo charset       | binary              |      1 |
| geostd8  | GEOSTD8 Georgian            | geostd8_general_ci  |      1 |
| cp932    | SJIS for Windows Japanese   | cp932_japanese_ci   |      2 |
| eucjpms  | UJIS for Windows Japanese   | eucjpms_japanese_ci |      3 |
+----------+-----------------------------+---------------------+--------+
39 rows in set (0.00 sec)

mysql>

Trus klo mau cari collationnya yg case sensitive bisa pake :
Code:
mysql> SHOW COLLATION WHERE `Collation` LIKE '%_cs' AND `Compiled` = 'Yes';
+-------------------+---------+----+---------+----------+---------+
| Collation         | Charset | Id | Default | Compiled | Sortlen |
+-------------------+---------+----+---------+----------+---------+
| latin1_general_cs | latin1  | 49 |         | Yes      |       1 |
| latin2_czech_cs   | latin2  |  2 |         | Yes      |       4 |
| cp1250_czech_cs   | cp1250  | 34 |         | Yes      |       2 |
+-------------------+---------+----+---------+----------+---------+
3 rows in set (0.00 sec)

mysql>

Moga membantu.. ketawa
Find all posts by this user
Quote this message in a reply
05-27-2012, 04:30 PM
Post: #5
gusvian Offline
./Devilz 1st Cadet
Posts: 35
Joined: Nov 2010
Reputation: 1
RE: Query Sql untuk memilih isi field yg huruf kecil dan besar
kalo pake cara gampangnya dibandingin binarynya aja,
di kasus om berarti
SELECT *
FROM <nama_table>
WHERE type LIKE BINARY 'I'

lebih lanjut bisa dilihat dimari : http://dev.mysql.com/doc/refman/5.0/en/c...ry-op.html
Find all posts by this user
Quote this message in a reply
05-27-2012, 04:43 PM (This post was last modified: 05-27-2012 04:43 PM by wenkhairu.)
Post: #6
wenkhairu Offline
Administrator
*******
Administrators
Posts: 1,345
Joined: Dec 2009
Reputation: 262
RE: Query Sql untuk memilih isi field yg huruf kecil dan besar
bener kata om dita itu collate databasenya mungkin ga ada, tapi mungkin cara ini bisa berhasil
Code:
Select * from <nama tabel>
where <nama kolom> COLLATE latin1_swedish_ci = '%i'

biasanya collate standar kan kebanyakan latin swedish, kalo ga, coba cara ini

Code:
SELECT * FROM <nama tabel> WHERE UPPER(<nama kolom>) = UPPER('%$q') OR LOWER(<nama kolom>) = LOWER(<nama kolom>)

semoga membantu
Visit this user's website Find all posts by this user
Quote this message in a reply
05-30-2012, 08:36 PM
Post: #7
Baplak Offline
./Devilz Commander
Posts: 284
Joined: Dec 2010
Reputation: 0
RE: Query Sql untuk memilih isi field yg huruf kecil dan besar
wah ya gan ane mao tanya kan ane punya aplikasi web yang ada database...ada yang tau gk.... kan ane merubah datanya di database... terus aplikasi ya berubah juga.. tanpa merefresh aplikasi ya ada yang tau gk
Visit this user's website Find all posts by this user
Quote this message in a reply
06-01-2012, 03:42 PM
Post: #8
beg3nk newb1e Offline
Momod paling Maho
**
Moderators
Posts: 980
Joined: Feb 2012
Reputation: 60
RE: Query Sql untuk memilih isi field yg huruf kecil dan besar
ane ijin belajar nyimak aja ya om, cz ane baru belajar sampe DML seneng
Visit this user's website Find all posts by this user
Quote this message in a reply
06-01-2012, 06:54 PM
Post: #9
danangmike Offline
./Devilz Officer
Posts: 56
Joined: Jan 2010
Reputation: 0
RE: Query Sql untuk memilih isi field yg huruf kecil dan besar
(05-30-2012 08:36 PM)Baplak Wrote:  wah ya gan ane mao tanya kan ane punya aplikasi web yang ada database...ada yang tau gk.... kan ane merubah datanya di database... terus aplikasi ya berubah juga.. tanpa merefresh aplikasi ya ada yang tau gk

kasih autorefresh aj
Find all posts by this user
Quote this message in a reply
06-01-2012, 07:14 PM
Post: #10
Baplak Offline
./Devilz Commander
Posts: 284
Joined: Dec 2010
Reputation: 0
RE: Query Sql untuk memilih isi field yg huruf kecil dan besar
(06-01-2012 06:54 PM)danangmike Wrote:  
(05-30-2012 08:36 PM)Baplak Wrote:  wah ya gan ane mao tanya kan ane punya aplikasi web yang ada database...ada yang tau gk.... kan ane merubah datanya di database... terus aplikasi ya berubah juga.. tanpa merefresh aplikasi ya ada yang tau gk

kasih autorefresh aj
caranya gymana om
Visit this user's website Find all posts by this user
Quote this message in a reply
« Next Oldest | Next Newest »
Pages (2): 1 2 Next »
Post Reply 


Topic Tools
Topic Link :
BBCode :
HTML Code :
View a Printable Version Send Thread to a Friend Subscribe to this thread
Submit Google Submit Face book Submit to Digg Submit to Reddit Submit to Furl Submit to Del.icio.us Submit to Jeqq

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  [Ask] CARA BUAT DATABASE UNTUK WEB INVESTASI jackerp 11 284 12-26-2012 01:05 PM
Last Post: od3yz
  Mari mengenal Query SELECT jibril 3 214 10-04-2012 11:36 PM
Last Post: jibril
  Facebook Query Language [ FQL ] Emily.Josan♫ 11 829 09-25-2012 02:46 AM
Last Post: 1st_N3iCs
  [Tutor] Konfigurasi PHPMyAdmin Untuk Multi Database Server ditatompel 3 435 08-16-2012 04:54 AM
Last Post: ditatompel
  [Ask] Error mysql query & array Emily.Josan♫ 15 2,820 08-17-2011 07:32 PM
Last Post: jomblo1991

Users Browsing
1 Guest(s)

  • Contact Us
  • devilzc0de
  • Return to Top
  • Mobile Version
  • RSS Syndication
  • Help
Current time: 06-20-2013, 05:03 AM Powered By MyBB, © 2002-2013 MyBB Group. Theme created by Justin S. | Mixed By Chaer.Newbie | Fixed By Aditya

USING THIS SITE INDICATES THAT YOU HAVE READ AND ACCEPT OUR TERMS. IF YOU DO NOT ACCEPT THESE TERMS, YOU ARE NOT AUTHORIZED TO USE THIS SITE