Browsed by
Tag: SQL

[Linux] Install PostgreSQL 9.4 on CentOS 7

[Linux] Install PostgreSQL 9.4 on CentOS 7

postgresql-logo

About
PostgreSQL is a powerful, open source object-relational database system. It has more than 15 years of active development and a proven architecture that has earned it a strong reputation for reliability, data integrity, and correctness. It runs on all major operating systems, including Linux, UNIX (AIX, BSD, HP-UX, SGI IRIX, Mac OS X, Solaris, Tru64), and Windows.

Read More Read More

Facebooktwittergoogle_plusredditpinterestlinkedinmail
[Ubuntu] Install OpenNMS, Open JDK7 and PostgreSQL3 on Ubuntu12.04LTS

[Ubuntu] Install OpenNMS, Open JDK7 and PostgreSQL3 on Ubuntu12.04LTS

1.0 Install Open JDK7

$ sudo apt-get install openjdk-7-jdk

1.1 Install Oracle JDK7

$ sudo apt-get install python-software-properties
$ sudo add-apt-repository ppa:webupd8team/java
$ sudo apt-get update
$ sudo apt-get install oracle-java7-installer

You can choose one of the above JDKs to install on your Ubuntu12.04, but if you install Oracle JDK7, maybe it will occur compilation fail.

Read More Read More

Facebooktwittergoogle_plusredditpinterestlinkedinmail
[SQL] SQL-語法收集(初階.進階)

[SQL] SQL-語法收集(初階.進階)

本文轉載於此

初階
查詢:列出住在比較溫暖地區的顧客
SELECT CUSTOMER_NAME,CITY
FROM CUSTOMER_V
WHERE CITY IN (‘台南市’,’高雄市’,’屏東市’)
查詢:針對CUSTOMER_V中地址在’台南市’,’高雄市’,’屏東市’中的所有顧客,列出他們的名稱.所在城市.而且顯示的順序是依據城市的字母順序,每個城市內的顧客亦照字母順序排列(預設為升冪)
SELECT CUSTOMER_NAME,CITY
FROM CUSTOMER_V
WHERE CITY IN (‘台南市’,’高雄市’,’屏東市’)
ORDER BY CITY , CUSTOMER_NAME

Read More Read More

Facebooktwittergoogle_plusredditpinterestlinkedinmail
[Oracle] ORA-02019:未找到遠程資料庫的連接說明

[Oracle] ORA-02019:未找到遠程資料庫的連接說明

使用Oracle時發生ORA-02019是因為database link沒有建立的緣故。Database link是讓使用者可以在A資料庫時去使用B資料庫的資料。

可用以下語法建立連接:

create public database link sample
CONNECT TO username IDENTIFIED BY password
USING ‘(DESCRIPTION =(ADDRESS_LIST =(ADDRESS =(PROTOCOL = TCP)(HOST = 10.1.10.221)(PORT = 1521)))(CONNECT_DATA =(SERVICE_NAME = dbName)))’;

使用時,只需在table name後面加上@XXXXX即可使用,如以下範例:
1. select * from xxTable@sample
2. delete from xxTable@sample
3. insert into xxTable (a,b,c,d,e) select * from xxTable@sample

紅字請自行更換成實際使用之數據。

Facebooktwittergoogle_plusredditpinterestlinkedinmail
[Oracle] OracleSQL–Decode函數的使用方法

[Oracle] OracleSQL–Decode函數的使用方法

本文轉載於:http://blog.itcert.org/archives/902

DECODE函數的作用:它可以將輸入數值與函數中的參數列表相比較,根據輸入值返回一個對應值。函數的參數列表是由若干數值及其對應結果值組成的若干序偶形式。當然,如果未能與任何一個實參序偶匹配成功,則函數也有默認的返回值。
區別於SQL的其它函數,DECODE函數還能識別和操作空值。

Read More Read More

Facebooktwittergoogle_plusredditpinterestlinkedinmail
[MySQL] 如何使用JSP連結MySQL資料庫?

[MySQL] 如何使用JSP連結MySQL資料庫?

安裝好Eclipse與Tomcat之後還缺少了JSP網頁中的重要元件之一:MySQL。在Java中,若要使用MySQL還必須使用JDBC。JDBC是用於執行SQL的Java API,它將資料庫存取的API與SQL陳述分開,實現資料庫無關的API介面,藉由JDBC統一的介面,開發人員只要專注於SQL陳述,而可以不必理會底層的資料庫驅動程式與相關介面。

Read More Read More

Facebooktwittergoogle_plusredditpinterestlinkedinmail