12345678910111213
INSERT INTO customers VALUES(NULL, 'Fang');-- 推荐更安全、扩展性更好的方式INSERT INTO customers(cust_id, cust_name) VALUES(NULL, 'Fang');-- 进一步,无需插入 AUTO_INCREMENT 属性的列INSERT INTO customers(cust_name) VALUES('Fang');-- 插入多条数据,单条语句插入比多次语句性能更高INSERT INTO customers(cust_name) VALUES('Fang'), ('Quan');-- 插入检索出的数据INSERT INTO customers(cust_id, cust_name) SELECT cust_id, cust_name FROM custnew;
123
SELECT vend_id COUNT(*) AS num_prods FROM products GROUP BY vend_id;SELECT cust_id, COUNT(*) AS orders FROM orders GROUP BY cust_id HAVING COUNT(*) >= 2;
1234567891011
-- 拼接字段 Concat()SELECT Concat(vend_name, ' (', vend_country, ')') FROM vendors ORDER BY vend_name;-- Trim() 去除空格SELECT Concat(RTrim(vend_name), ' (', RTrim(vend_country), ')') FROM vendors ORDER BY vend_name;-- 使用别名 ASSELECT Concat(RTrim(vend_name), ' (', RTrim(vend_country), ')') AS vend_title FROM vendors ORDER BY vend_name;-- 执行算术计算SELECT prod_i, quantity, item_price, quantity*item_price AS expanded_price FROM orderitems WHERE order_num = 20005;
12345678910111213141516171819202122
-- 显示数据库SHOW DATABASES;-- 选择数据库USE some_db;-- 显示表SHOW TABLES;-- 显示表的列信息SHOW COLUMNS FROM some_table;DESCRIBE some_table;-- 显示数据库服务器状态信息SHOW STATUS;-- 显示授予用户的权限SHOW GRANTS;-- 显示服务器错误信息/警告信息SHOW ERRORS;SHOW WARNINGS;
不知Linux原生是否有自带这类命令……
1234567891011121314
kill_pid_recursively(){ local pid=$1 local parent_pid=$2 if [ ! -z ${pid} ]; then for child_pid in `pgrep -P ${pid}`; do kill_pid_recursively ${child_pid} ${pid} done echo "kill PID: ${pid}, its PPID is ${parent_pid}" kill -9 ${pid} fi}kill_pid_recursively ${SOME_PID} 'nothing'
Bootstrap3
jquery-tmpl
<script id="template-dialog-alert" type="text/x-jquery-tmpl"><div class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> <div class="modal-dialog modal-sm"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> <h5 class="modal-title">提示</h5> </div> <div class="modal-body"> </div> </div> </div></div></script>
《JavaScript 面向对象编程指南》笔记
123456
function Logger() { if (!Logger.single_instance) { Logger.single_instance = this; } return Logger.single_instance;}
内容(HTML),外观(CSS),行为(JavaScript)
<font>
使用 Homebrew,先安装 homebrew-php,再安装 phpredis
Homebrew