The column alias could be used in the GROUP BY, HAVING or ORDER BY clause, but not in the WHERE clause.
It's possible to perform a sort using an expression result:
SELECT name, MONTH(birthday) m FROM t ORDER BY MONTH(birthday);
SELECT name, MONTH(birthday) m FROM t ORDER BY m;
A query might run faster if the ORDER BY uses an indexed column.
ORDER BY can be used with DELETE or UPDATE to force rows to be deleted or updated in certain order.
Non-binary strings sort in the order defined by their collation. If the collation is case-insensitive, the sort result is also case-insensitive.
If the collation is binary, the numeric value determines the sort order.
The sort order for members of an ENUM or SET column is based on their internal numeric values, which means, for ENUM, it follows the defined order in the column definition, for SET, it follows the sum values of internal numeric values.
You can change these behaviours by using CAST():
SELECT mon FROM t ORDER BY CAST(mon AS CHAR);
Limiting a Selection Using LIMIT:
... LIMIT row_count
... LIMIT skip_count, row_count
When ORDER BY and LIMIT are used together, MySQL applies ORDER BY first and then LIMIT.
DISTINCT result may be different by the column collations.
A difference between DISTINCT and GROUP BY is that DISTINCT doesn't cause row sorting (in MySQL, GROUP BY does cause sorting).
DISTINCT can be used with the COUNT() funtion to count how many distinct values a column contains. In this case, NULL values are ignored.
SELECT COUNT(DISTINCT col1) FROM t;
It's possible to perform a sort using an expression result:
SELECT name, MONTH(birthday) m FROM t ORDER BY MONTH(birthday);
SELECT name, MONTH(birthday) m FROM t ORDER BY m;
A query might run faster if the ORDER BY uses an indexed column.
ORDER BY can be used with DELETE or UPDATE to force rows to be deleted or updated in certain order.
Non-binary strings sort in the order defined by their collation. If the collation is case-insensitive, the sort result is also case-insensitive.
If the collation is binary, the numeric value determines the sort order.
The sort order for members of an ENUM or SET column is based on their internal numeric values, which means, for ENUM, it follows the defined order in the column definition, for SET, it follows the sum values of internal numeric values.
You can change these behaviours by using CAST():
SELECT mon FROM t ORDER BY CAST(mon AS CHAR);
Limiting a Selection Using LIMIT:
... LIMIT row_count
... LIMIT skip_count, row_count
When ORDER BY and LIMIT are used together, MySQL applies ORDER BY first and then LIMIT.
DISTINCT result may be different by the column collations.
A difference between DISTINCT and GROUP BY is that DISTINCT doesn't cause row sorting (in MySQL, GROUP BY does cause sorting).
DISTINCT can be used with the COUNT() funtion to count how many distinct values a column contains. In this case, NULL values are ignored.
SELECT COUNT(DISTINCT col1) FROM t;
09/28: SQL:1999
09/26: Javascript > prototype
第4回 JavaScriptでオブジェクト指向プログラミング − @IT
prototypeを使うと:
メソッドをインスタンスにコピーしないため、メモリを節約できる。
後からでも、クラスを変更することで、インスタンスにも変更を反映できる。
まず、インスタンスを探し、インスタンスのプロトタイプを探し、クラスのプロトタイプを探す。
prototypeをオブジェクトリテラルで記述すると見た目がきれい。
prototypeを使うと:
メソッドをインスタンスにコピーしないため、メモリを節約できる。
後からでも、クラスを変更することで、インスタンスにも変更を反映できる。
まず、インスタンスを探し、インスタンスのプロトタイプを探し、クラスのプロトタイプを探す。
prototypeをオブジェクトリテラルで記述すると見た目がきれい。
Animal.prototype = { getVoice : function() { window.alert(this.name + "「チュウ!」"); }, toString : function() { window.alert(this.name + " " + this.sex); } };
09/24: Linux > SSH マニュアル
ssh_config
ServerAliveInterval (サーバ生存確認の間隔)
ServerAliveInterval (サーバ生存確認の間隔)
09/24: Linux > SSH
keep-alive for ssh"Heartbeat 300"
How To Tile Windows In Gnome the ubuntu guy
wmtile
# Login as root and browse to /usr/share/tile/
# Open the rc file in gedit
# Change the second option to read “multi-desktop netwm”
wmtile
# Login as root and browse to /usr/share/tile/
# Open the rc file in gedit
# Change the second option to read “multi-desktop netwm”
09/21: Jetty Eclipse Download Site
How to install Adobe PDF Reader with Plug-in for Mozilla Firefox in Feisty Fawn -- Ubuntu Geek
sudo apt-get install acroread mozilla-acroread acroread-plugins
sudo apt-get install acroread mozilla-acroread acroread-plugins
09/21: Linux > SVN GUI client
Using metadata example:
SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'db_name' AND TABLE_NAME = 'table_name';
SHOW TABLES FROM db_name LIKE '%aaa%'; (no WHERE)
SHOW CREATE TABLE table_name;
* Display the CREATE TABLE statement including its indexes.
DESCRIBE table_name;
SHOW COLUMNS FROM table_name;
SHOW FIELDS FROM table_name;
SHOW INDEX FROM table_name;
* If the index is PK only and the PK consists of 2 columns, the output is 2 rows.
SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'db_name' AND TABLE_NAME = 'table_name';
SHOW TABLES FROM db_name LIKE '%aaa%'; (no WHERE)
SHOW CREATE TABLE table_name;
* Display the CREATE TABLE statement including its indexes.
DESCRIBE table_name;
SHOW COLUMNS FROM table_name;
SHOW FIELDS FROM table_name;
SHOW INDEX FROM table_name;
* If the index is PK only and the PK consists of 2 columns, the output is 2 rows.
09/14: MySQL > Indexes
A PRIMARY KEY cannot contain NULL values.
A UNIQUE index can be allowed to contain NULL values.
A UNIQUE index that can't contain NULL is functionally equivalent to a PRIMARY KEY.
A FULLTEXT index is specially designed for text searching.
A SPATIAL index applies only to columns that have spatial data types.
CREATE TABLE t
(
id INT NOT NULL PRIMARY KEY,
name CHAR(30) NOT NULL
);
CREATE TABLE t
(
id INT NOT NULL,
name CHAR(30) NOT NULL,
primary key (id, name)
);
For all index types other than PRIMARY KEY, you can name an index by including the name just before the column list.
Index names are displayed by the SHOW CREATE TABLE or SHOW INDEX statement.
ALTER TABLE t ADD PRIMARY KEY (id), ADD INDEX [index_name] (firstname, lastname);
CREATE UNIQUE INDEX index_name ON t (id);
CREATE INDEX index_name ON t (firstname, lastname);
Note that with CREATE INDEX, it's necessary to provide an index name.
Only ALTER TABLE supports the use of PRIMARY KEY.
MEMORY tables use HASH index by default. HASH index is usable only for comparisons that use the = or <=> operator. Also, changing non-unique indexes is relatively slow.
If a MEMORY table contains non-unique indexes and there will be many duplicate values and will be used with many type of comparison operators, BTEE indexes is better.
ALTER TABLE t ADD INDEX USING BTREE (id);
ALTER TABLE t DROP PRIMARY KEY;
ALTER TABLE t DROP index_name, DROP index_name2;
To drop index, you must specify its name.
DROP INDEX `PRIMARY` ON t;
To drop a PRIMARY KEY with DROP INDEX, use the index name PRIMARY with a quoted identifier because the work 'PRIMARY' is a reserve word.
A UNIQUE index can be allowed to contain NULL values.
A UNIQUE index that can't contain NULL is functionally equivalent to a PRIMARY KEY.
A FULLTEXT index is specially designed for text searching.
A SPATIAL index applies only to columns that have spatial data types.
CREATE TABLE t
(
id INT NOT NULL PRIMARY KEY,
name CHAR(30) NOT NULL
);
CREATE TABLE t
(
id INT NOT NULL,
name CHAR(30) NOT NULL,
primary key (id, name)
);
For all index types other than PRIMARY KEY, you can name an index by including the name just before the column list.
Index names are displayed by the SHOW CREATE TABLE or SHOW INDEX statement.
ALTER TABLE t ADD PRIMARY KEY (id), ADD INDEX [index_name] (firstname, lastname);
CREATE UNIQUE INDEX index_name ON t (id);
CREATE INDEX index_name ON t (firstname, lastname);
Note that with CREATE INDEX, it's necessary to provide an index name.
Only ALTER TABLE supports the use of PRIMARY KEY.
MEMORY tables use HASH index by default. HASH index is usable only for comparisons that use the = or <=> operator. Also, changing non-unique indexes is relatively slow.
If a MEMORY table contains non-unique indexes and there will be many duplicate values and will be used with many type of comparison operators, BTEE indexes is better.
ALTER TABLE t ADD INDEX USING BTREE (id);
ALTER TABLE t DROP PRIMARY KEY;
ALTER TABLE t DROP index_name, DROP index_name2;
To drop index, you must specify its name.
DROP INDEX `PRIMARY` ON t;
To drop a PRIMARY KEY with DROP INDEX, use the index name PRIMARY with a quoted identifier because the work 'PRIMARY' is a reserve word.
deb http://archive.ubuntulinux.jp/ubuntu-ja gutsy/ deb-src http://archive.ubuntulinux.jp/ubuntu-ja gutsy/ deb http://archive.ubuntulinux.jp/ubuntu-ja gutsy-ja/ deb-src http://archive.ubuntulinux.jp/ubuntu-ja gutsy-ja/
Linux&BSD:導入メモ:Ubuntu 7.40
Japanese Input and Fonts in Ubuntu 7.10
Japanese_Input_and_Fonts_in_Ubuntu_8.04_using_SCIM
Japanese Input and Fonts in Ubuntu 7.10
Japanese_Input_and_Fonts_in_Ubuntu_8.04_using_SCIM
09/11: MySQL > Tips
MySQL 5.1 supports a row level replication. Before 5.1, it was a SQL statement replication, so that some functions such as UUID() were not replicated properly.
EXPLAIN (testing SQL);
MySQL does not use INDEX if you use LIKE '%...' or LIKE '_...'.
MySQL may not use INDEX if you use the result of some function.
SELECT * FROM table WHERE TO_DAYS(created_date) <= 7;
InnoDB's count(*) is much slower than MyISAM
EXPLAIN (testing SQL);
MySQL does not use INDEX if you use LIKE '%...' or LIKE '_...'.
MySQL may not use INDEX if you use the result of some function.
SELECT * FROM table WHERE TO_DAYS(created_date) <= 7;
InnoDB's count(*) is much slower than MyISAM
09/11: Linux > SSHFS
% printenv | less
UNIX Tutorial Eight
UNIX Tutorial Eight
* OSTYPE (OS type) * USER (your login name) * HOME (the path name of your home directory) * HOST (the name of the computer you are using) * ARCH (the architecture of the computers processor) * DISPLAY (the name of the computer screen to display X windows) * PRINTER (the default printer to send print jobs) * PATH (the directories the shell should search to find a command)
09/10: Linux > UNIX Tutorial Four
UNIX Tutorial Four
$ apropos keyword
Arnolds wor(l)ds Eclipse problems solved (finally)
Install the SUN Java (at least 5.0) $ sudo update-java-alternatives -s java-1.x.x-sun $ eclipse -vm /usr/lib/jvm/java-1.x.x-sun/jre/bin/java * you might need to use sudo to create some files at the first time.
09/10: MySQL > Altering Tables
Add, delete and modify a column:
ALTER TABLE my_table ADD new_date_column DATE NOT NULL [FIRST | AFTER existing_column];
ALTER TABLE my_table DROP dropping_column;
ALTER TABLE my_table MODIFY modifying_column DATETIME NOT NULL;
ALTER TABLE my_table CHANGE original_column new_name CHAR(40) NOT NULL;
ALTER TABLE my_table CHANGE original_column new_name CHAR(40) NOT NULL AUTO_INCREMENT, ADD PRIMARY KEY(new_name);
* You should specify the all column attributes when you use MODIFY. If you want to disallow NULL in the column, the column definition provided for MODIFY must include the NOT NULL attribute.
Renaming a table:
ALTER TABLE my_table RENAME TO my_renamed_table;
RENAME TABLE my_table1 TO tmp, my_table2 TO my_table1, tmp TO my_table2;
* For TEMPORARY tables, RENAME TABLE does not work.
ALTER TABLE my_table ADD new_date_column DATE NOT NULL [FIRST | AFTER existing_column];
ALTER TABLE my_table DROP dropping_column;
ALTER TABLE my_table MODIFY modifying_column DATETIME NOT NULL;
ALTER TABLE my_table CHANGE original_column new_name CHAR(40) NOT NULL;
ALTER TABLE my_table CHANGE original_column new_name CHAR(40) NOT NULL AUTO_INCREMENT, ADD PRIMARY KEY(new_name);
* You should specify the all column attributes when you use MODIFY. If you want to disallow NULL in the column, the column definition provided for MODIFY must include the NOT NULL attribute.
Renaming a table:
ALTER TABLE my_table RENAME TO my_renamed_table;
RENAME TABLE my_table1 TO tmp, my_table2 TO my_table1, tmp TO my_table2;
* For TEMPORARY tables, RENAME TABLE does not work.
09/10: Linux > SSH
ITmedia エンタープライズ : Linux Tips「SSHのログイン制限を確認しよう」
PermitRootLogin no PermitEmptyPasswords no PasswordAuthentication no AllowUsers hoge CheckHostIP yes
FreeNX - Community Ubuntu Documentation
$ gksudo gedit /etc/apt/sources.list deb http://free.linux.hp.com/~brett/seveas/freenx feisty-seveas freenx deb-src http://free.linux.hp.com/~brett/seveas/freenx feisty-seveas freenx $ wget http://free.linux.hp.com/~brett/seveas/freenx/seveas.gpg -O- | sudo apt-key add - $ sudo apt-get update $ sudo aptitude install freenx $ sudo nxserver --adduser username $ sudo nxserver --passwd username $ sudo nxserver --restart
09/06: Linux > システムをチェックする際のコマンド
cat /var/log/messages | less <<< all the system message
cat /var/log/boot.log | less <<< boot log
dmesg -n 1 <<< all panic message at boot time by rc.sysinit
/proc システムの状態
procinfo /procのサマリー表示
vmstat 秒数 メモリやディスクの利用状況
last ログインしたユーザの履歴
w 現在ログインしているユーザ
lastlog show login info by user
top プロセスの監視
ps aux 実行中のプログラム eg. ps aux | grep service
ps axo user,pid,ppid,tty,start,time,command | grep agent | grep -v grep
ps -ef 実行中のプログラム
ps f -a hierarchical view of the parent-child relationships
ps -l shows more detailed information
pstree
uptime CPUの負荷をチェック
netstat -an 通信の調査
lsof オープンファイルの確認
lsof -i -n オープンポートとプロセスの対応を確認
lsof -i:22 -n 指定した番号のポートをオープンしているプロセスの確認
lsof -u(ログイン名orID) ログイン名 or ユーザーIDを指定
find / -type f \( -perm -u+s -o -perm -g+s \) -ls 不審なファイルのチェック
find / -type f -perm -04000 -ls 不審なファイル(SUID)のチェック
find / -perm +6000 -exec ls -l {} \; SUID or SGID
du カレントフォルダ内の使用量
(eg. du -ha /home | grep '^[0-9]\{3,\}M': find more than 100MB in home)
df ディスクの状態
(eg. df -i: check inode usage, df -l: check local filesystems only)
hdparm -ft /dev/sda1 sda1にベンチマークテスト
dumpe2fs -h Show the file system parameters
fsck デバイス(HDD)のチェック(使用前にはumountが必須、設定を変更するには tune2fs)
-A: All file system
-C: Progress bars
-N: Dry run
-V: Verbose output
-a Noninteractive
makebootdisk [kernel version] <<< uname -r
fdisk -l <<< To see /dev info
pnpdump <<< viwe isa p&p
file <<< determin file type
# file tree*.rpm <<< check RPM’s architecture
# file /etc/* | grep empty <<< find all the empty file
# uname -a Linuxのバージョンチェック
# cat /proc/version
09/06: Linux check memory usage
Linux check memory usage
$ top $ vmstat $ free -m -t
How to mount a remote ssh filesystem using sshfs Ubuntu Blog
$ sshfs -o transform_symlinks example.com:/stuff /media/home-pc
$ fusermount -u /media/home-pc
$ sshfs -o transform_symlinks example.com:/stuff /media/home-pc
$ fusermount -u /media/home-pc
MySQL AB :: MySQL 4.1 リファレンスマニュアル :: 7.5.9.3 ロックを取得する読み取り
SELECT LOCK IN SHARE MODE and FOR UPDATE
テーブル型毎のロックの挙動
InnoDB型のREADロックとWRITEロックの取得は、MyISAM型のそれとは大きく異なります。MySQLのトランザクション処理はMVCC(Multi Version Concurrency Control: 多版型同時実行制御)を基に行われるので、WRITEロックとREADロックは競合しません。
データ操作(INSERT, UPDATE, DELETE)はデータ検索(SELECT)の実行をブロックしませんし、逆もまた然りです(補足 1)。特に、SELECT文の実行は一切ブロックされません。
次に、WRITEロック間の関係ですが、一意性(UNIQUE)制約もしくは主キー(PRIMARY KEY)制約を持つテーブルの場合は行レベルロック、それ以外のテーブルではテーブルロックが取得されます。
これはMySQLの実装方式に起因するもので、MySQL特有の挙動です。
SELECT FOR UPDATE文で排他的ロックを、SELECT LOCK IN SHARE MODE文で共有ロックを設定することができます。これらはトランザクションブロック内でのみ実行されます。
IN SHARE MODE と FOR UPDATE 読み取りによって設定されたロックは、トランザクションがコミットされたりロールバックされたりした時にリリースされます。
MySQL SELECT文
SELECT * FROM table_a USE INDEX (use_index_name);
SELECT * FROM table_a IGNORE INDEX (ignore_index_name);
SELECT col1, col2, col3 FROM table_a ORDER BY 1, 2;
SELECT STRAIGHT_JOIN * FROM T1,T2,T3;
SELECT HIGH_PRIORITY * FROM table_a;
SELECT SQL_BIG_RESULT * FROM table_a GROUP BY col1;
SELECT SQL_BUFFER_RESULT * FROM table_a;
SELECT SQL_SMALL_RESULT * FROM table_a GROUP BY col1;
SELECT SQL_CALC_FOUND_ROWS * FROM table_a LIMIT 100;
SELECT FOUND_ROWS();
SELECT * FROM table_a FOR UPDATE;
SELECT LOCK IN SHARE MODE and FOR UPDATE
テーブル型毎のロックの挙動
InnoDB型のREADロックとWRITEロックの取得は、MyISAM型のそれとは大きく異なります。MySQLのトランザクション処理はMVCC(Multi Version Concurrency Control: 多版型同時実行制御)を基に行われるので、WRITEロックとREADロックは競合しません。
データ操作(INSERT, UPDATE, DELETE)はデータ検索(SELECT)の実行をブロックしませんし、逆もまた然りです(補足 1)。特に、SELECT文の実行は一切ブロックされません。
次に、WRITEロック間の関係ですが、一意性(UNIQUE)制約もしくは主キー(PRIMARY KEY)制約を持つテーブルの場合は行レベルロック、それ以外のテーブルではテーブルロックが取得されます。
これはMySQLの実装方式に起因するもので、MySQL特有の挙動です。
SELECT FOR UPDATE文で排他的ロックを、SELECT LOCK IN SHARE MODE文で共有ロックを設定することができます。これらはトランザクションブロック内でのみ実行されます。
IN SHARE MODE と FOR UPDATE 読み取りによって設定されたロックは、トランザクションがコミットされたりロールバックされたりした時にリリースされます。
MySQL SELECT文
SELECT * FROM table_a USE INDEX (use_index_name);
SELECT * FROM table_a IGNORE INDEX (ignore_index_name);
SELECT col1, col2, col3 FROM table_a ORDER BY 1, 2;
SELECT STRAIGHT_JOIN * FROM T1,T2,T3;
SELECT HIGH_PRIORITY * FROM table_a;
SELECT SQL_BIG_RESULT * FROM table_a GROUP BY col1;
SELECT SQL_BUFFER_RESULT * FROM table_a;
SELECT SQL_SMALL_RESULT * FROM table_a GROUP BY col1;
SELECT SQL_CALC_FOUND_ROWS * FROM table_a LIMIT 100;
SELECT FOUND_ROWS();
SELECT * FROM table_a FOR UPDATE;
09/05: PHP > Eclipse plugin まとめ
DbEdit update site http://dbedit.sourceforge.net/update
QuickRex update site http://www.bastian-bergerhoff.com/eclipse/features/
eSpell download site http://www.bdaum.de/eclipse/
SVNKit update site http://svnkit.com/
Subclipse update site http://subclipse.tigris.org/update_1.2.x
SimpleTest download site http://simpletest.org/en/extension_eclipse.html
EMF, GEF, VE, WST(WTP) and XSD from Callisto discovery site
PDT update site http://downloads.zend.com/pdt
JSEclipse download site http://www.adobe.com/cfusion/entitlement/index.cfm?e=labs%5Fjseclipse
QuickRex update site http://www.bastian-bergerhoff.com/eclipse/features/
eSpell download site http://www.bdaum.de/eclipse/
SVNKit update site http://svnkit.com/
Subclipse update site http://subclipse.tigris.org/update_1.2.x
SimpleTest download site http://simpletest.org/en/extension_eclipse.html
EMF, GEF, VE, WST(WTP) and XSD from Callisto discovery site
PDT update site http://downloads.zend.com/pdt
JSEclipse download site http://www.adobe.com/cfusion/entitlement/index.cfm?e=labs%5Fjseclipse
Use Evolution with Microsoft Exchange : Ubuntu (6.06 / 6.10) : Ubuntu Tutorials : Dapper - Edgy - Feisty - Gutsy
Server Type: “Microsoft Exchange”
Username: domain/username (ie; your windows domain and user account)
OWA URL: The URL for your office / domain webmail. (ie; https://webmail.domain.com/exchange/)
Server Type: “Microsoft Exchange”
Username: domain/username (ie; your windows domain and user account)
OWA URL: The URL for your office / domain webmail. (ie; https://webmail.domain.com/exchange/)
09/05: Linux > Keyboard shortcuts
[Ctrl] + [Alt] + [F1] : Change to CUI (command console) [Ctrl] + [Alt] + [L] : Lock the screen [Alt] + [F2] : Run command
How To Use NTFS Drives/Partitions Under Ubuntu Edgy Eft | HowtoForge - Linux Howtos and Tutorials
$ sudo vi /etc/apt/sources.list Add deb http://flomertens.keo.in/ubuntu/ edgy main main-all $ sudo apt-get update $ sudo apt-get install pmount $ sudo apt-get install ntfs-3g $ sudo mkdir /media/windows $ sudo mount -t ntfs-3g /dev/sdd1 /media/windows (-o force)
09/05: Linux > VMWare server
How To Install VMware Server On Ubuntu 7.04 (Feisty Fawn) | HowtoForge - Linux Howtos and Tutorials
How-to for 8.04
# sudo vmware-install.pl
Before running VMware Server for the first time, you need to configure it by invoking the following command: "/usr/bin/vmware-config.pl". Do you want this program to invoke the command for you now? [yes] NO
# sudo ./runme.pl (vmware-any-any-updateXXX)
This time, we can run vmware-config.pl.
How-to for 8.04
# sudo vmware-install.pl
Before running VMware Server for the first time, you need to configure it by invoking the following command: "/usr/bin/vmware-config.pl". Do you want this program to invoke the command for you now? [yes] NO
# sudo ./runme.pl (vmware-any-any-updateXXX)
This time, we can run vmware-config.pl.
A TEMPORARY table is visible only to the client that created it and may be used only by that client.
Different clients can create TEMPORARY tables that have the same name and no conflict occurs.
The server drops a TEMPORARY table automatically when the client connection ends if the client has not dropped it.
A TEMPORARY table may have the same name as a non-TEMPORARY table. The non-TEMPORARY table becomes hidden to the client that created the TEMPORARY table as long as the TEMPORARY table exists.
A TEMPORARY table can be renamed only with ALTER TABLE. You can't use RENAME TABLE.
* A MEMORY table is temporary in the sense that it's contents are lost if you restart the server, but the table definition continues to exists in its database.
Different clients can create TEMPORARY tables that have the same name and no conflict occurs.
The server drops a TEMPORARY table automatically when the client connection ends if the client has not dropped it.
A TEMPORARY table may have the same name as a non-TEMPORARY table. The non-TEMPORARY table becomes hidden to the client that created the TEMPORARY table as long as the TEMPORARY table exists.
A TEMPORARY table can be renamed only with ALTER TABLE. You can't use RENAME TABLE.
* A MEMORY table is temporary in the sense that it's contents are lost if you restart the server, but the table definition continues to exists in its database.
(A) CREATE TABLE ... SELECT ... creates a table and populates it from the result set of the SELECT statement.
(B) CREATE TABLE ... LIKE ... creates an empty table using the definition of another existing table.
The difference is (A) statement copies the column name and data type from the original table, but does not retain the column attribute information. Also the new table sues the default storage engine.
Some table attributes are not copied, even when issuing (B).
If the original table is a MyISAM table for which the DATA DIRECTORY or INDEX DIRECTORY table options are specified, those options are not copied to the new table.
Foreign Key definitions in the original table are not copied to the new table.
(B) CREATE TABLE ... LIKE ... creates an empty table using the definition of another existing table.
The difference is (A) statement copies the column name and data type from the original table, but does not retain the column attribute information. Also the new table sues the default storage engine.
Some table attributes are not copied, even when issuing (B).
If the original table is a MyISAM table for which the DATA DIRECTORY or INDEX DIRECTORY table options are specified, those options are not copied to the new table.
Foreign Key definitions in the original table are not copied to the new table.
09/03: Linux > GNU screen
Oreilly Screen
screenのススメ
SCREEN
"C-a c" : create a new screen
"C-a C-\" : quite screen
# screen -list
# screen -S [name]
screenのススメ
SCREEN
"C-a c" : create a new screen
"C-a C-\" : quite screen
# screen -list
# screen -S [name]
UNIX Tutorial Five
If you start a long-running task and forget to add the ampersand, you can still swap that task into the background. Instead of pressing ctrl-C (to terminate the foreground task) and then restarting it in the background, just press ctrl-Z after the command starts, type bg, and press enter. You'll get your prompt back and be able to continue with other work. Use the fg command to bring a background task to the foreground.
$ sleep 1000 (type any command to be background) Ctrl + z, then type bg $ jobs (to check current jobs) $ fg %1Processes - Linux Shell Commands
cc hugepgm.c > outlist &Note: It's a good idea to redirect the output of background tasks to a file, as shown here, since the background task still shares the console with foreground tasks. If you don't, the background task will splash any output it might produce all over your screen while you're editing a file or typing another command.
If you start a long-running task and forget to add the ampersand, you can still swap that task into the background. Instead of pressing ctrl-C (to terminate the foreground task) and then restarting it in the background, just press ctrl-Z after the command starts, type bg, and press enter. You'll get your prompt back and be able to continue with other work. Use the fg command to bring a background task to the foreground.
09/03: LPIC > Using the Linux Shell
The /bin/false is a special shell which returns a nonzero error code for blocking access by a user.
The /etc/nologin is used to block logins for accounts and echo a message.
The /etc/profile is the global configuration file that affects all users' environment if they use the bash shell. The user's ~/.bash_profile, if et exists, is the next script that's sourced. This script calls, or sources, ~/.bashrc.
Multiple Command Operators
The semicolon causes all listed commands to be executed independently.
make modules ; echo DO MAKE MODULES_INSTALL NEXT
The double ampersand causes the second command to be excuted if the first command has an exit status of 0 (success).
The double pipe is opposite of the double ampersand.
The /etc/nologin is used to block logins for accounts and echo a message.
The /etc/profile is the global configuration file that affects all users' environment if they use the bash shell. The user's ~/.bash_profile, if et exists, is the next script that's sourced. This script calls, or sources, ~/.bashrc.
Multiple Command Operators
The semicolon causes all listed commands to be executed independently.
make modules ; echo DO MAKE MODULES_INSTALL NEXT
The double ampersand causes the second command to be excuted if the first command has an exit status of 0 (success).
The double pipe is opposite of the double ampersand.
09/03: PHP > Unit test + UI test
To see which storage engines your server supports, use the SHOW ENGINES;.
CREATE TABLE [db name].[table name] (...) ENGINE = InnoDB;
ALTER TABLE [db name].[table name] ENGINE = MyISAM;
The build-in default value of the storage_engine system variable is MyISAM.
The default storage engine can be specified at server startup with the --default-storage-engine option.
Or
SET GLOBAL storage_engine = [engine name]; if you have the SUPER privilege.
SET SESSION storage_engine = [engine name];
SET storage_engine = [engine name];
CREATE TABLE [db name].[table name] (...) ENGINE = InnoDB;
ALTER TABLE [db name].[table name] ENGINE = MyISAM;
The build-in default value of the storage_engine system variable is MyISAM.
The default storage engine can be specified at server startup with the --default-storage-engine option.
Or
SET GLOBAL storage_engine = [engine name]; if you have the SUPER privilege.
SET SESSION storage_engine = [engine name];
SET storage_engine = [engine name];