PIXNET Logo登入

互聯網 - 大數據

跳到主文

本部落格為互聯網熱門頭條訊息管理中心

部落格全站分類:生活綜合

  • 相簿
  • 部落格
  • 留言
  • 名片
  • 3月 09 週四 201720:31
  • DOM操作


文章出處
DOM操作,JS來操作頁面
wiindows對象操作
document對象操作
點擊事件;將DIV要執行的事件代碼裝封
onclick  鼠標單擊       ondblelick  鼠標雙擊
onkeydown  按鍵按下     onkeypress  只要按鍵
onkeyup  按鍵抬起的時候觸發
onmousedown   鼠標按下
onmousemove  鼠標移出
onmouseover   鼠標移上
onmouseup     按上的瞬間
在表格中
onble   失去焦點觸發
onfocus   獲得焦點觸發
onselect   選中時觸發
<select>
    <option>......</option>
    <option>......</option>
</select>                下拉列表
this 代表該元素本身
事件:
一般來說有兩個參數
load(sender,e)
{
                          }
sender   代表事件源,即誰觸發的事件
e代表事件數據
事件是一個特殊的委托(代理)
null   空
間隔和延遲
window setinterval
間隔執行,1000毫秒為1秒
例    windows.setinterval("alert("aa"),1000")
     每隔1秒彈出一個窗口
window.setIimeout(...)
延遲執行,不會再重復
(繼續閱讀...)
文章標籤

AutoPoster 發表在 痞客邦 留言(0) 人氣(2)

  • 個人分類:生活學習
▲top
  • 3月 09 週四 201720:31
  • 網頁主菜單,橫向


文章出處
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>無標題文檔</title>
<style type="text/css" >
*{margin:0px ;padding:0px;}
.yiji{width:100px; height:36px; text-align:center; line-height:36px; vertical-align:middle; float:left;}
.yiji:hover{
background
-color:#F09;
color:#FFF;;}
</style>
</head>
<body>
<div style="width:500px; height:36px; border:1px solid #60F; margin:0px auto;">
<div class="yiji" onmouseover="xianshi('erji1')" onmouseout="yincang('erji1')" >首頁</div>
<div id="erji1" style=" float:left; width:0px; display:none;">
<div style="width:100px; height:36px; position:relative; top:38px; left:-100.5px; background-color:#06C; text-align:center; line-height:36px; vertical-align:middle;">首頁1</div>
<div style="width:100px; height:36px; position:relative;top:38px; left:-100.5px; background-color:#06C;text-align:center; line-height:36px; vertical-align:middle;">首頁2</div>
<div style="width:100px; height:36px; position:relative; top:38px; left:-100.5px; background-color:#06C;text-align:center; line-height:36px; vertical-align:middle;">首頁3</div>
</div>
<div class="yiji" onmouseover="xianshi('erji2')" onmouseout="yincang('erji2')">產品中心</div>
<div id="erji2" style=" float:left; width:0px; display:none;">
<div style="width:100px; height:36px; position:relative;top:38px; left:-100.5px; background-color:#06C; text-align:center; line-height:36px; vertical-align:middle;">產品中心1</div>
<div style="width:100px; height:36px; position:relative; top:38px; left:-100.5px; background-color:#06C; text-align:center; line-height:36px; vertical-align:middle;">產品中心2</div>
<div style="width:100px; height:36px; position:relative; top:38px; left:-100.5px; background-color:#06C; text-align:center; line-height:36px; vertical-align:middle;">產品中心3</div>
</div>
<div class="yiji" onmouseover="xianshi('erji3')" onmouseout="yincang('erji3')">活動中心</div>
<div id="erji3" style=" float:left; width:0px; display:none;">
<div style="width:100px; height:36px; position:relative;top:38px; left:-100.5px; background-color:#06C;text-align:center; line-height:36px; vertical-align:middle;">活動中心1</div>
<div style="width:100px; height:36px; position:relative;top:38px; left:-100.5px; background-color:#06C; text-align:center; line-height:36px; vertical-align:middle;">活動中心2</div>
<div style="width:100px; height:36px; position:relative; top:38px; left:-100.5px;background-color:#06C; text-align:center; line-height:36px; vertical-align:middle;">活動中心3</div>
</div>
<div class="yiji" onmouseover="xianshi('erji4')" onmouseout="yincang('erji4')">聯系我們</div>
<div id="erji4" style=" float:left; width:0px; display:none;">
<div style="width:100px; height:36px; position:relative; top:38px; left:-100.5px; background-color:#06C; text-align:center; line-height:36px; vertical-align:middle;">聯系我們1</div>
<div style="width:100px; height:36px; position:relative;top:38px; left:-100.5px; background-color:#06C;text-align:center; line-height:36px; vertical-align:middle;">聯系我們2</div>
<div style="width:100px; height:36px; position:relative;top:38px; left:-100.5px;background-color:#06C;text-align:center; line-height:36px; vertical-align:middle;">聯系我們3</div>
</div>
<div class="yiji" onmouseover="xianshi('erji5')" onmouseout="yincang('erji5')">郵箱</div>
<div id="erji5" style=" float:left; width:0px; display:none;" >
<div style="width:100px; height:36px; position:relative;top:38px; left:-100.5px; background-color:#06C; text-align:center; line-height:36px; vertical-align:middle;">郵箱1</div>
<div style="width:100px; height:36px; position:relative;top:38px; left:-100.5px; background-color:#06C; text-align:center; line-height:36px; vertical-align:middle;">郵箱2</div>
<div style="width:100px; height:36px; position:relative;top:38px; left:-100.5px; background-color:#06C;text-align:center; line-height:36px; vertical-align:middle;">郵箱3</div>
</div>
</div>
</body>
<script type="text/javascript">
function xianshi(d)
{
var erji=document.getElementById(d);
erji
.style.display="block";
}
function yincang(d)
{
var erji=document.getElementById(d);
erji
.style.display="none";
}
</script>
</html>

鼠標放上會拉伸,鼠標拿走會收起來
(繼續閱讀...)
文章標籤

AutoPoster 發表在 痞客邦 留言(0) 人氣(2)

  • 個人分類:生活學習
▲top
  • 3月 09 週四 201720:31
  • 幾種基本樣式,背景圖,字體,下劃線,行高垂直等


文章出處
<div style=:width:600px; heiget:600px; background-color:...; background-image; background-repea:...; background-position;
                  寬度               高度                背景顏色                     背景圖片                   背景圖平鋪                 背景圖位置                  
background-attachment; background-size 200px 200px;
      背景圖滾動                                背景圖大小  
 
<div style=font-famliy:...; font-size:...; font-weight:italic; font-weight:bold; color;
              設置字體樣式     設置字體大小          傾斜                   加粗                  顏色 
 text-decoration:underline && overline && line-through && none >
                          下劃線           上劃線          刪除線        去掉下劃線
 
<a id="d1" href="http://www.baidu.com">超鏈接</a>                              #d1{width:100px; height:100px; text-decoration:none; color:..;}
                                                          去掉下劃線  改變字體顏色
 
 <div id="m1">測試</div>                                                   
#m1{width:300px; height:300px; background-color:#0F0; color:#60C; text-align:center; vertical-align:middle; line-height:300px;}
                                                                                                           水平對齊                垂直對齊                   行高
 
*{ margin:0px auto; padding:0px}   調整無邊距    auto 使圖片居中
 
(繼續閱讀...)
文章標籤

AutoPoster 發表在 痞客邦 留言(0) 人氣(0)

  • 個人分類:生活學習
▲top
  • 3月 09 週四 201720:31
  • 快速搭建php環境


文章出處
WAMP:在windows系統下搭建PHP開發環境
APPSERVER:
兩種可用于開發環境的,一般用WAMP
LAMP構架
Linux系統
Apache服務器管理軟件
Mysql數據庫
php語言
 
 php服務器管理軟件Apache
.net服務器管理軟件IIS
Java服務器管理軟件TomCat
管理軟件起的作用
 
數據庫:Mysql
將數據存到數據庫內
數據庫內的類型:int 整型             varchar(20)字符串  20指的是長度,只有varchar寫長度,其他的不用
                      bit布爾型數據       datetime  日期日時類型          float小數       double小數         text 長文本
                      money 存貨幣      image存二進制數據
 varchar有長度限制         text沒有文本限制
數據表:
1、列名   類型   長度
2、主健
每個表都要有,主健列是不能重復的,是能夠唯一標識一條數據的
3、控制列的類型(索引)
唯一索引         非空(允許空值打勾)
unique    唯一
4、外健   存在與兩個表之間的關系
讓一張表可以控制另一張表
若表一引用表二,則表一是從
是主健的表就是主表,主表控制從表
從表加外健
關系型數據庫
數據庫的設計:
三大范式:
1、第一范式:保證列的原子性
相對于功能,拆到最小,不能再拆了
2、第二范式:每一列都要和主健有關系,每一列和該表有關系
3、第三范式:每一列都要和主健有直接關系
 
(繼續閱讀...)
文章標籤

AutoPoster 發表在 痞客邦 留言(0) 人氣(0)

  • 個人分類:生活學習
▲top
  • 3月 09 週四 201720:31
  • 數據查詢,簡單查詢及高級查詢


文章出處
查詢所有列
1.select * from info
查特定列
2.select code,name from info
查出列后加別名,再查姓名
3.select code as '代號',name as '姓名' from info
條件查詢,單條件查詢
4.select * from info where code='p001'
兩個條件,并且的關系
5.select * from info where code='p001' and nation='n001'
范圍查詢
6.select * from car where price between 20 and 50
離散查詢,關鍵字in
7.select * from car where price in(20,30,40)
模糊查詢,使用關鍵字來查,關鍵字like,后面跟字符串
8.select * from car where name like '%奧迪%'
排序,根據某一列,默認的是升序
9.select * from car order by price desc
去重查詢
10.select distinct brand from car
分頁查詢,關鍵字limit,數字分別表示跳過幾條數據,顯示幾條數據
11.select * from car limit 5,5
聚合函數,count代表數量,sum求和   平均  最大值  最小值
12.count()      sum()   avg()   max()   min()
分組查詢,主要用來做統計,根據brand來分
13.select brand,count(*) from car group by brand
高級查詢
1.連接查詢,對結果集列的擴展
select * from info
select * from info,nation   #形成笛卡爾積(連接兩張或多張表,數據量小的時候可以用)
select * from info,nation where info.nation=nation.code(用條件來篩選,如果有重復的,一定要先寫表名,沒有重名的就可以直接寫)
select info.code,info.name,sex,nation.name,birthday from info,nation where info.nation=nation.code(篩選出自己想要的數據)
select * from info join nation on info.nation=nation.code(關鍵字join后面加條件,如果只運行前半句select * from info join的話,和上面的情況一樣,會出現笛卡爾積,和join配合使用的是on,on后面加連接條件)
2.聯合查詢,對結果集行的擴展
select code,name from info
union(關鍵字,聯合顯示兩張表,查的列的數量要相同)
select code,name from nation
3.子查詢
父查詢:外層查詢
子查詢:里層查詢
子查詢的結果做為父查詢的條件
(1)無關子查詢
子查詢在執行的時候和父查詢沒有關系,子查詢可以單獨執行
1.查詢民族為‘漢族’的所有人員信息
父查詢:select * from info where nation=()
子查詢:select code from nation where name='漢族'
(整合,子查詢的結果當做父查詢的條件)select * from info where nation=(select code from nation where name='漢族')
2.查詢系列名為‘寶馬5系’的所有汽車信息
select * from car where brand=(select brand_code from brand where brand_name='寶馬5系')
(2)相關子查詢
子查詢在執行的時候和父查詢有關系,子查詢不可以單獨執行
1.查詢汽車表中油耗小于該系列平均油耗的所有汽車信息
父查詢:select * from car where oil<(該系列平均油耗)
子查詢:select avg(oil) from car where brand=該系列
select * from car as a where oil<(select avg(oil) from car as b where b.brand=a.brand)
(繼續閱讀...)
文章標籤

AutoPoster 發表在 痞客邦 留言(0) 人氣(2)

  • 個人分類:生活學習
▲top
  • 3月 09 週四 201720:31
  • TSQL語句


文章出處
1.創建數據庫
create database test3;
2.刪除數據庫
drop database test3;
3.創建表
create table test
(
    code varchar(20),
    name varchar(20)
);
create table test1
(
    code varchar(20) primary key,
    name varchar(20)
);
create table test2
(
    code varchar(20) primary key,
    name varchar(20) not null
);
create table zhu
(
    code int primary key,
    name varchar(20)
);
create table cong
(    
    code int primary key,
    name varchar(20),
    zhu int,
    foreign key (zhu) references zhu(code)
);
create table haoyou
(
    ids int auto_increment primary key,
    me varchar(20),
    friends varchar(20)
);
4.刪除表
drop table haoyou;
關鍵字:
primary key 主鍵
not null 非空
foreign key (列名) references 主表名(列名)  外鍵
auto_increment 自增長列
注意:1.每條語句后加分號
2.最后一列后面不加逗號
3.符號一定是英文的
自增長列  我的用戶名   好友的用戶名
1.聯合主鍵
2.加一列自增長
作業:
1 . 修改表的語句  
二:對數據的增刪改查
CRUD操作
C:create 添加
R:read 查詢
U:update 修改
D:delete 刪除
1.C:添加數據
insert into 表名 values('n001','張三');
insert into test2 values('n001','');
insert into test2(code) values('n001');  指定列添加
insert into haoyou values('zs','ls');
注意:
1.如果添加的數據是字符串,需要加<單引號>,如果是其他類型不要加單引號2.在添加數據的時候,值的數量要和列匹配
3.在添加數據的時候,可以指定列添加
4.如果要添加的列是自增長列,可以給一個空字符串
5.注釋語法:#
(繼續閱讀...)
文章標籤

AutoPoster 發表在 痞客邦 留言(0) 人氣(2)

  • 個人分類:生活學習
▲top
  • 3月 09 週四 201720:30
  • css3


文章出處
css3邊框:
border-radius:  屬性,添加像素,可以使邊框角變圓,50px的邊框為半圓形,50%則會變成一個橢圓形。
box-shadow: 屬性,添加像素,顏色,例;
<div style="width:100px; height:50px; box-shadow:30px 0px #CCCC33" ></div>
出現的形狀如圖所示,代表距離左30px,距離下0px,顏色則是黃色
<div style="width:100px; height:50px; box-shadow:0px 30px #999999"></div>
出現的形狀如圖所示,代表距離左0px;距離下30px;顏色則是灰色
<div style="width:100px; height:50px; box-shadow:0px 30px 10px #999999"></div>
在后面再加一個10px,則陰影部分會虛化,也就是會模糊
<div style="width:100px; height:50px; box-shadow:30px 30px 10px #999999 inset"></div>
再在后面加個inset,則陰影部分和藍色部分進行了顏色交換,并且只顯示里面的部分,inset是設置在里面的意思
border-imager屬性,可以允許使用圖片作為邊框,但border-imager屬性在IE和QQ瀏覽器中并不兼容。
Css背景:
background-size屬性,可以規定背景圖片的尺寸
background-origin屬性,規定根據邊框定位還是文本定位;
background-origin:border-box;根據邊框定位
background-origin:content-box;根據文本定位
 多重背景圖片,background-imager
<body style="  background-image:url(1a92b3afb07e757970bfdcac20f9561b.gif), url(57e4b8e9aab1d_1024.jpg); background-repeat:no-repeat">
</body>
兩張背景圖重疊,第一張為優先級
 
如果不加background-repeat,則兩個背景圖會鋪滿整個屏幕
給文字加陰影:
text-shadow屬性,可以向文本應用陰影效果
四個值,分別代表距離左側,距離上側,模糊程度及陰影顏色
<div style="font-size:18px; color:#609; text-shadow:30px 20px 10px #CC0066">文字陰影</div>
效果如圖所示。
 文本自動換行:word-wrap屬性,允許文本強制文本進行換行,這意味著會對單詞進行拆分,它的值是break-word允許對單詞進行拆分換到下一行
CSS3 轉換:
可以對元素進行移動、縮放、移動、拉長或拉伸。
可以使用2D或3D轉換來轉換我們的元素
2D轉換:
transform屬性,內置方法
1、rotate()進行旋轉,括號內部寫旋轉角度,默認順時針旋轉,允許負值,元素將進行逆時針旋轉。
<div style=" position:relative; top:100px; left:100px;width:100px; height:100px; transform:rotate(45deg)">45度旋轉</div>
如圖所示,里面的文字也會跟著一起旋轉,deg是度的意思
2、translate()從當前位置進行移動,括號內為x、y值,允許負值,將反方向移動
<div style=" left:100px;width:100px; height:100px; transform:translate(200px,200px)">位置移動</div>
如圖所示,移動位置不光可以用定位移動,還可以xy軸移動
3、scale()改變原始尺寸,按照倍數變化,括號內為widch、height的倍數
<div style=" width:100px; height:100px; ">你好</div>
<div style=" width:100px; height:100px; transform:scale(3,2); margin:200px">你好</div>
如圖所示,改變元素的倍數,里面的文字也隨之改變
4、skew()水平、垂直方向進行扭轉,括號內是水平扭轉角度、垂直扭轉角度
<div style=" width:100px; height:100px; transform:skew(0deg,30deg); margin:50px ">縱向扭轉30度</div>
<div style="width:100px; height:100px; transform:skew(30deg,0deg); margin:100px">橫向扭轉30度</div>
<div style="width:100px; height:100px; transform:skew(30deg,30deg); margin:100px">橫向縱向都扭轉30度</div>
如圖所示,里面的文字也會隨之變化
3D轉換:
transform屬性,變形、轉換,內置方法:
1、rotateX(),沿水平x軸進行垂直的翻轉,括號內寫轉動度數
2、rotateY(),沿垂直Y軸進行水平的翻轉,括號內寫轉動度數
2D轉換和3D轉換的區別:2D轉換僅僅在于平面,文字可以看出并沒有反過來
3D轉換是相當于鏡面效果的,進行了前后空間(涉及到了Z軸)的占用進行的翻轉
<div style="width:200px; height:100px; ">元素</div>
<br />
<div style="width:200px; height:100px; transform:rotateY(180deg)">Y翻轉180</div>
<div style="width:200px; height:100px; transform:rotateX(120deg)">X翻轉120</div>
如圖所示,3D翻轉,像鏡面一樣,字也是反的
CSS3過渡:transition屬性,專門應對顏色、長度、寬度、位置等變化過渡
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>無標題文檔</title>
</head>
<style type="text/css">
#a1
{ width:200px; height:100px; background-color:#909; border:1px solid #000}
#a2
{ width:200px; height:100px; background-color:#909;border:1px solid #000; transition:2s}
#a1:hover
{ background-color:#969}
#a2:hover
{ background-color:#99C}
#bg
{ width:200px; height:200px; border:1px solid #000; position:relative; left:400px}
#tb
{ position:relative; left:0px; top:0px; transition:1s}
#tb:hover
{ left:-200px}
#tb:active
{ left:-400px}
#c1
{ width:200px; height:200px; background-color:#09F; transition:1s}
#c1:hover
{ width:300px; height:400px}
</style>
<body>
<div id="a1">這是快速變得</div>
<div id="a2">使用過渡的</div>
<br />
<br />
<div id="bg">
<table id="tb" width="600" height="200" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td><img src="201291893228996.jpg" width="200" height="200" /></td>
<td><img src="1655299809.jpg" width="200" height="200" /></td>
<td><img src="20130109080830267.jpg" width="200" height="200" /></td>
</tr>
</tbody>
</table>
<div>
<br /><br />
<div id="c1" ></div>
</body>
</html>

代碼如上,圖片如下:
CSS3動畫:
通過CSS3,我們能夠創建動畫,這樣可以在許多網頁中取代動畫圖片、Flash動畫以及JavaScript動畫。
想要創建CSS3動畫,需要遵循@keyframes規則。
@keyframes規則用于創建動畫。在@keyframes中規定某項CSS樣式,就能創建由當前樣式逐漸改為新樣式的動畫效果。
注:IE需要10及以上。
創建好動畫之后需要綁定到某個選擇器,否則不會產生任何動畫效果。
使用animation進行動畫捆綁。兩個值:動畫名稱、時長。
時間長度必須規定,否則默認為0。也就是表示沒有動畫效果。
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>無標題文檔</title>
</head>
<style type="text/css">
#c2
{ width:300px; height:300px; background-color:#C0C; animation:myfirst 5s}
@keyframes myfirst
{
from{ background-color
:#C0C}
to
{ background-color:#C9F}
}
</style>
<body>
<div id="c2"></div>
</body>
</html>

 
 
動畫是使元素從一種樣式逐漸變化為另一種樣式的效果。
可以改變任意多的樣式以及任意多的次數。
我們一般情況下使用0%~100%來規定動畫發生的時機。或者使用關鍵詞from...to...,效果等同于0%~100%。
0%是動畫的開始,100%是動畫的完成。
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>無標題文檔</title>
</head>
<style type="text/css">
#c2
{ width:300px; height:300px; background-color:#C0C; animation:myfirst 5s}
@keyframes myfirst
{
0%{ background
:#F00}
15%
{ background:#F90}
25%
{ background:#FF0}
35%
{ background:#3F6}
55%
{ background:#6FF}
65%
{ background:#63F}
100%
{ background:#C00}
}
</style>
<body>
<div id="c2"></div>
</body>
</html>

多項改變時只需要在每個百分號后的花括號內寫上就可以了。
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>無標題文檔</title>
<style>
body
{font-size:24px; color:#60F;}
div
{
width
:300px;
height
:300px;
background
:black;
position
:relative;/*由于需要進行位置改變,所以增加了position屬性*/
animation
:myfirst 5s infinite alternate;/*動畫捆綁,兩個值,動畫名稱、時長,加上一個無限執行,交替執行*/
}
@keyframes myfirst
{/*改變位置和背景顏色*/
0% {background
:red; border-radius:90px; box-shadow:-35px 0px 15px gray; left:0px; top:0px;}
25%
{background:yellow; border-radius:0px; left:400px; top:0px;}
50%
{background:blue; border-radius:90px; left:400px; top:300px;}
75%
{background:green; border-radius:0px; box-shadow:0px 30px 15px gray; left:0px; top:300px;}
100%
{background:red; border-radius:20px; left:0px; top:0px;}
}
</style>
</head>
<body>
本示例中,更改了背景顏色以及定位、陰影效果三個樣式。
<br />
由于本動畫在捆綁選擇器時添加了一個infinite值,那么本動畫將無限執行下去。
<br />
在無限執行的基礎之上增加了一個alternate值,那么本動畫會進行正反交替執行。
<div></div>
</body>
</html>

 
(繼續閱讀...)
文章標籤

AutoPoster 發表在 痞客邦 留言(0) 人氣(5)

  • 個人分類:生活學習
▲top
  • 3月 09 週四 201720:30
  • TSQL語句練習題

文章出處
 
1、 查詢Student表中的所有記錄的Sname、Ssex和Class列。
select Sname,Ssex,Class from Student
2、 查詢教師所有的單位即不重復的Depart列。
select distinct Depart from Teacher
 
3、 查詢Student表的所有記錄。
select * from Student
4、 查詢Score表中成績在60到80之間的所有記錄。
select * from Score where Degree>60 and Degree<80
5、 查詢Score表中成績為85,86或88的記錄。
select * from Score where Degree in( 85,86,88)
6、 查詢Student表中“95031”班或性別為“女”的同學記錄。
select * from Student where class='95031' or Ssex='女'
7、 以Class降序查詢Student表的所有記錄。
select * from Student order by Class desc
8、 以Cno升序、Degree降序查詢Score表的所有記錄。
select * from Score order by Cno,Degree desc
9、 查詢“95031”班的學生人數。
select count(*) from student where class='95031'
10、 查詢Score表中的最高分的學生學號和課程號。(子查詢或者排序)
select Sno,Cno  from Score where Degree=(select max(Degree) from Score)
第二種方法
select sno,cno from score order by degree desc limit 0,1
11、 查詢每門課的平均成績。
select avg(degree),cno from Score group by cno
12、 查詢Score表中至少有5名學生選修的并以3開頭的課程的平均分數。
select avg(Degree) from Score where cno in(select cno from score group by cno having count(*)>4) and cno like '3%'
第二種方法
select avg(degree) from score where cno like '3%'group by cno having count(*)>4
13、 查詢分數大于70,小于90的Sno列。
select Sno from Score where Degree>70 and Degree<90
14、 查詢所有學生的Sname、Cno和Degree列。
select Sname,Cno,Degree from Student,Score where Student.Sno=Score.Sno
15、 查詢所有學生的Sno、Cname和Degree列。
select Sno,Cname,Degree from course,Score where course.cno=Score.cno
16、 查詢所有學生的Sname、Cname和Degree列。
select sname,cname,degree from student,course,score where student.sno=score.sno and  course.cno=score.cno
第二種方法
sele sname,cname,degree from student join score on student.sno=score.sno join course on course.con=score.cno
17、 查詢“95033”班學生的平均分。
select avg(Degree) from Score where sno in (select sno from Student where class='95033')
 
 18、假設使用如下命令建立了一個grade表:
create table grade(low  int(3),upp  int(3),rank  char(1))
insert into grade values(90,100,’A’)
insert into grade values(80,89,’B’)
insert into grade values(70,79,’C’)
insert into grade values(60,69,’D’)
insert into grade values(0,59,’E’)
現查詢所有同學的Sno、Cno和rank列。
select sno,cno,rank from score,grade where degree between low and upp
19、查詢選修“3-105”課程的成績高于“109”號同學成績的所有同學的記錄。
select * from score where cno='3-105' and degree>(select max(degree) from score where sno='109')
 
 
第二種方法
select * from score where cno='3-105' and degree>(select max (degree)form score where sno='109' and cno='3-105')
20、查詢score中選學多門課程的同學中分數為非最高分成績的記錄。
select * from score where sno in(select sno from score group by sno having count(*)>1) and degree<(select max(degree) from score where sno in(select sno from score group by sno having count(*)>1))
 
第二種方法
select * from score as a where sno in(select sno from score group by sno having count(*)>1) and degree<(select max(degree) from score as b.cno=a.cno)
21、查詢成績高于學號為“109”、課程號為“3-105”的成績的所有記錄。
select * from score where degree>(select degree from score where sno='109'and cno='3-105')


 
22、查詢和學號為108的同學同年出生的所有學生的Sno、Sname和Sbirthday列。
select * from student year(sbirthday)=(select year(sbirthday) from student where sno='108')
23、查詢“張旭“教師任課的學生成績。
select * from score where cno in(select cno from course where tno=(select tno from  teacher where tname='張旭'))
 
24、查詢選修某課程的同學人數多于5人的教師姓名。
select tname from teacher where tno=(select tno from course where cno = (select cno from score group by cno having count(*)>5))
 
25、查詢95033班和95031班全體學生的記錄。
select * from student where class in('95033','95031')
 
 26、  查詢存在有85分以上成績的課程Cno
select distinct cno from score where degree>85

 
 27、查詢出“計算機系“教師所教課程的成績表。
select * from score where cno in(select cno from course where tno in(select tno from teacher where depart='計算機系'))
 
28、查詢“計算 機系”與“電子工程系“不同職稱的教師的Tname和Prof。
select tname,prof from teacher where depart='計算機系' and prof not in(select prof from teacher where depart='電子工程系' )union
select tname,prof from teacher where depart='電子工程系' and prof not in(select prof from teacher where depart='計算機系')
 
 
29、查詢選修編號為“3-105“課程且成績至少高于選修編號為“3-245”的同學的Cno、Sno和Degree,并按Degree從高到低次序排序。
select * from score where cno='3-105' and degree>any(select degree from score where cno='3-245')
 
30、查詢選修編號為“3-105”且成績高于選修編號為“3-245”課程的同學的Cno、Sno和Degree.
select * from score where cno='3-105' and degree>all(select degree from score where cno='3-245')
 
31、 查詢所有教師和同學的name、sex和birthday.
select sname,ssex,sbirthday from student
union
select tname,tsex,tbirthday from teacher
 
32、查詢所有“女”教師和“女”同學的name、sex和birthday.
select sname,ssex,sbirthday from student where ssex='女'
union
select tname,tsex,tbirthday from teacher where tsex='女'
 
33、 查詢成績比該課程平均成績低的同學的成績表。
select * from score a where degree<(select avg(degree) from score b where b.cno=a.cno )
 
34、 查詢所有任課教師的Tname和Depart.
select tname,depart from teacher where tno in(select tno from course )
 
35 、 查詢所有未講課的教師的Tname和Depart.
select tname,depart from teacher where cno in(select tno from course where cno not in(select distinct cno from score))
36、查詢至少有2名男生的班號。
select class from student where ssex='男' group by class having count(*)>1
 
37、查詢Student表中不姓“王”的同學記錄。
select * from student where sname not like '王%'
 
38、查詢Student表中每個學生的姓名和年齡。
select sname,year(now())-year(sbirthday) from student
 
39、查詢Student表中最大和最小的Sbirthday日期值。
select max(sbirthday),min(sbirthday) from student
 
40、以班號和年齡從大到小的順序查詢Student表中的全部記錄。
select * from student order by class desc,sbirthday
 
41、查詢“男”教師及其所上的課程。
select tname,cname from course,teacher where course.tno=teacher.tno and teacher.tsex='男'
 
42、查詢最高分同學的Sno、Cno和Degree列。
select * from score where degree=(select max(degree) from score)
 
第二種方法:
select * from score order by degree desc limit 0,1
43、查詢和“李軍”同性別的所有同學的Sname.
select sname from student where ssex=(select ssex from student where sname='李軍')
 
44、查詢和“李軍”同性別并同班的同學Sname.
select sname from student where ssex=(select ssex from student where sname='李軍') and class=(select class from student where sname='李軍')
 
45、查詢所有選修“計算機導論”課程的“男”同學的成績表。
select * from score where cno=(select cno from course where cname='計算機導論') and sno in(select sno from student where ssex='男')
 
 
(繼續閱讀...)
文章標籤

AutoPoster 發表在 痞客邦 留言(0) 人氣(31)

  • 個人分類:生活學習
▲top
  • 3月 09 週四 201720:30
  • php語句


文章出處
判斷變量的方法:
例;
$a="";
var_dump(empty($a));
輸出的結果為true
若$a=10;
var_dump(empty($a));
輸出falst
若沒有變量,直接輸出
var_dump(empty($a));
則輸出結果為true
如果$=0;
輸出的結果也是true,會被當成空的
var_dump(empty($a));    判斷變量是否為空
var_dump(isset($a));      判斷變量是否定義
unset($a);                     刪除變量
例:$a=10;
     unset($a);
     var_dump(isset($a));
輸出的結果為falst,變量被刪掉
&代表變量的地址
例:$a=10;
     $b=&$a;
若    echo $b;  輸出的值為10
若  $b=5;
   echo $a;   輸出的值為5
數學運算
例:
$a=10;
$b=5;
echo $a+$b;
輸出的結果為15;
加"+"    減"-"   乘"*"   除"/"    取余"%"
弱類型中,結果可以等于小數
強類型中,結果整數除整數,結果只能等于小數
$a++;代表自身+1             $a--;代表自身-1
$a+=3;代表  $a=$a+3;  自身加三
$a-=3; 代表  $a=$a-3;   自身減三
若 $s="hello";
    $s.="張三";
   echo $s;
則輸出的結果是 hello 張三
邏輯:
例; $a=10;
      $b=8;
 var_dump($a<$b);
或者   var_dump($a!=$b); 是不等于的意思
條件不滿足就返回一個  falst  
條件滿足就返回一個     true
若    $a=true;
       $b=false;
    var_dump($a&&$b);
如果多個bool型數據進行與的運算,只要其中有一個false,結果就是fales
    var_dump($a||$b);
如果多個bool型數據進行或的運算,只要其中有一個true,結果就是true
var_dump(!$a);
邏輯非相當于取反
三木運算符:
例: $a=10;
      $b=8;
   echo $a==$b?"相等":"不相等";
  最后輸出的結果為不相等
      $sex=false;
   echo $sex?"男":"女";
  是true的話輸出男,是false的話輸出女
錯誤抑制符:
一般會出現的三種情況:  //       Notice;提醒(提示)
                                //        Warning;警告(比提示更嚴重一級)
                                //        error;錯誤
@可以屏蔽一些提示
Notice;有一些提醒不是真正的錯誤
沒有輸出的 ,例   $a+$b    寫錯誤抑制符,要寫在前面,@$a+$b
有輸出的要這樣寫,   echo @$a;
語句:
1、分支語句
例:   $a=8
 if($a<10)
{
echo "A小于10";
}
把上面的花括號省略也是可以的
if($a<10)
echo "A小于10";
echo"hello";
如果輸出兩句話就不可以了
還有if的分支;
例:  $a=8;
    if ($a<10)
{
echo "ok";
}
    else
{
echo "no";
}
 
$a=8;
if($a<10)
{
echo "A小于10";
}
else if($a<20)
{
echo "A在10到20之間";
}
else
{
echo "A大于20";
}
if的嵌套:
$a=8;
if ($a<20)
{
     if ($a<10)
     {
        ...............
     }
      else
      {
          ................
       }
}
分支的第二種形式; switch
$a=2;
switch ($a)
{
          case 1;                     //   如果a等于1
          echo "1111";
          break;
          case 2;
          echo "2222";
          break;
          case 3;
          echo "3333";
          break;
          default;
          echo "0000";
}
循環語句:
JS的寫法:
for ( var i=0;i<10;i++)
{
     alert(i);
}
php中,for循環:
for ( $i=0;$i<10;$i++)
{
  echo $i;        //  如果想換行        echo $i."<br>";
}
while 循環
$n=0;
while ($n<10)
{
echo "{$n}<br>";
$n++;
}
do    while 循環
$n=0;
do
{
echo"{$n}<br>";
$n++;
}
while ($n<10)
(繼續閱讀...)
文章標籤

AutoPoster 發表在 痞客邦 留言(0) 人氣(5)

  • 個人分類:生活學習
▲top
  • 3月 09 週四 201720:30
  • php常用函數


文章出處
1、隨機數和時間
echo rand();  //隨機數生成器
echo rand(0,10); //生成某個范圍內的隨機數
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>無標題文檔</title>
</head>
<body>
<?php
echo rand(0,10);
?>
</body>
</html>

輸出的結果是:
0到10之間的隨機數
echo time();  //取當前時間戳
echo date("Y-m-d H:i:s",1381253766); //格式化顯示時間
echo strtotime("2013-10-09 01:36:06"); //將字符串轉換為時間戳
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>無標題文檔</title>
</head>
<body>
<?php
echo time(); //取當前時間戳
echo date("Y-m-d H:i:s",1381253766); //格式化顯示時間
echo strtotime("2013-10-09 01:36:06"); //將字符串轉換為時間戳
?>
</body>
</html>

輸出的結果:
 
2.字符串函數
$str = "Hello|World|ni|hao";
$attr = array("aa","bb","cc","dd");
echo strlen($str); //取字符串的長度
var_dump(strcmp($str,"hello world")); //比較兩個字符串
echo strtolower($str); //轉小寫
echo strtoupper($str); //轉大寫
var_dump(explode("|",$str)); //拆分字符串,返回數組
echo implode("--",$attr); //將數組元素拼接成一個字符串
echo substr_replace($str,"***",0,5); //替換指定位置的字符串
//echo str_replace("|","***",$str); //查找替換
//echo substr($str,0,5); //截取字符串
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>無標題文檔</title>
</head>
<body>
<?php
$str = "Hello|World|ni|hao";
$attr = array("aa","bb","cc","dd");
echo strlen($str); //取字符串的長度
var_dump(strcmp($str,"hello world")); //比較兩個字符串
echo strtolower($str); //轉小寫
echo strtoupper($str); //轉大寫
var_dump(explode("|",$str)); //拆分字符串,返回數組
echo implode("--",$attr); //將數組元素拼接成一個字符串
echo substr_replace($str,"***",0,5); //替換指定位置的字符串
echo str_replace("|","***",$str); //查找替換
echo substr($str,0,5); //截取字符串
?>
</body>
</html>

輸出的結果:
 
//3.正則表達式
$str =<<<A
內容
A;
echo preg_replace("/\d/","#",$str); //替換
var_dump(preg_split("/\d/",$str)); //拆分
preg_match("/\d/",$str,$arr); //匹配第一個滿足正則的字符串
preg_match_all("/\d/",$str,$arr); //匹配所有滿足正則的字符串
var_dump($arr);
preg_match_all("/\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/",$str,$arr);
var_dump($arr);
4.數組方法
$attr = array(1,2,3,4,5,1);
var_dump(in_array(6,$attr)); //判斷某個值是否在數組里面
var_dump(array_reverse($attr)); //翻轉數組
echo count($attr); //取數組長度
var_dump(array_unique($attr)); //去重
unset($attr[1]); //刪除數組的元素
var_dump(array_values($attr)); //重新索引
var_dump(array_merge($attr,array(5,6))); //合并數組
array_push($attr,"hello"); //向數組里面添加一個元素,返回索引
(繼續閱讀...)
文章標籤

AutoPoster 發表在 痞客邦 留言(0) 人氣(0)

  • 個人分類:生活學習
▲top
«1...202122230»

pop-under

參觀人氣

  • 本日人氣:
  • 累積人氣:

線上人數

Marquee

最新文章

  • 文章列表
  • jvm系列(四):jvm調優-命令大全(jps jstat jmap jhat jstack jinfo)
  • spring boot(一):入門篇
  • jvm系列(一):java類的加載機制
  • jvm系列(三):java GC算法 垃圾收集器
  • spring boot 實戰:我們的第一款開源軟件
  • jvm系列(六):jvm調優-從eclipse開始
  • 混合應用技術選型
  • jvm系列(二):JVM內存結構
  • spring boot(五):spring data jpa的使用

熱門文章

  • (1,763)jQuery之前端國際化jQuery.i18n.properties
  • (630)技術筆記:Indy控件發送郵件
  • (515)linux下安裝sqlite3
  • (501)學習筆記: Delphi之線程類TThread
  • (242)VC單選按鈕控件(Radio Button)用法(轉)
  • (104)單條件和多條件查詢
  • (51)淺談config文件的使用
  • (26)Tomcat shutdown執行后無法退出進程問題排查及解決
  • (22)基于 Asp.Net的 Comet 技術解析
  • (15)Java中的抽象類

文章分類

  • 生活學習 (2,296)
  • 未分類文章 (1)

最新留言

  • [20/04/24] 我是女生想約炮 有男生願意給我溫暖的嗎?我賴是woyou58 於文章「(1)從底層設計,探討插件式GIS框架的...」留言:
    我叫黎兒女生最近內心掙扎著要不要約炮我的line:woy...

文章搜尋

文章精選

誰來我家

Live Traffic Feed