Variasi SELECT Statement
.
Banyak sekali cara (sql script) untuk menampilkan data seperti gambar diatas, saya contohkan 5 bentuk, diantaranya adalah :
SELECT * FROM BARANG WHERE KODE >='0000100' AND KODE <='0000110'
SELECT KODE,MERK,NAMA,SATUAN,HARGA,KETERANGAN FROM BARANG
WHERE KODE IN ('0000100','0000101','0000102','0000103','0000104',
'0000105','0000106','0000107','0000108','0000109','0000110')
SELECT KODE,MERK,NAMA,SATUAN,HARGA,KETERANGAN FROM (
SELECT KETERANGAN,HARGA,SATUAN,NAMA,MERK,KODE FROM BARANG
) AS DJIE_QUERY WHERE KODE >='0000100' AND KODE <='0000110'
SELECT * FROM BARANG WHERE KODE >='0000100' AND KODE <='0000105'
UNION
SELECT * FROM BARANG WHERE KODE IN('0000106','0000107','0000108','0000109')
UNION
SELECT * FROM BARANG WHERE KODE LIKE '0000110'
SELECT * FROM BARANG
JOIN
(SELECT * FROM BARANG WHERE KODE >='0000100' AND KODE <='0000110') AS DJIE_QUERY
ON BARANG.KODE=DJIE_QUERY.KODE
Banyak sekali cara (sql script) untuk menampilkan data seperti gambar diatas, saya contohkan 5 bentuk, diantaranya adalah :
SELECT * FROM BARANG WHERE KODE >='0000100' AND KODE <='0000110'
SELECT KODE,MERK,NAMA,SATUAN,HARGA,KETERANGAN FROM BARANG
WHERE KODE IN ('0000100','0000101','0000102','0000103','0000104',
'0000105','0000106','0000107','0000108','0000109','0000110')
SELECT KODE,MERK,NAMA,SATUAN,HARGA,KETERANGAN FROM (
SELECT KETERANGAN,HARGA,SATUAN,NAMA,MERK,KODE FROM BARANG
) AS DJIE_QUERY WHERE KODE >='0000100' AND KODE <='0000110'
SELECT * FROM BARANG WHERE KODE >='0000100' AND KODE <='0000105'
UNION
SELECT * FROM BARANG WHERE KODE IN('0000106','0000107','0000108','0000109')
UNION
SELECT * FROM BARANG WHERE KODE LIKE '0000110'
SELECT * FROM BARANG
JOIN
(SELECT * FROM BARANG WHERE KODE >='0000100' AND KODE <='0000110') AS DJIE_QUERY
ON BARANG.KODE=DJIE_QUERY.KODE
Posting Komentar untuk "Variasi SELECT Statement"