Create Databasexue1Go--Create a database Usexue1Go--referencing a databaseCreate TableXinxi (Codeint, namevarchar( -), Xuehaodecimal(Ten), Brithdaydecimal(Ten),)--Create an information tableInsert intoXinxiValues(1,'Zhang San',2016042701, .-4- -)Insert intoXinxiValues(2,'John Doe',2016042702, .-4- -)Insert intoXinxiValues(3,'Harry',2016042703, .-4- -)Insert intoXinxiValues(4,'Caifan',2016042704, .-4- -)Insert intoXinxiValues(5,'Zhao Qi',2016042705, .-4- -)Insert intoXinxiValues(6,'Qin Eight',2016042706, .-4- -)
--Input information
--Search All informationSelect * fromStudent--all information for people with a number of 6Select * fromStudentwhereCode=6--the name of the person who queried the number 8SelectName fromStudentwhereCode=8--query everyone's nameSelectName fromStudent--Check all information for people over the age of 24Select * fromStudentwhereAge> ---the names of all the people who are taller than 175SelectName asName fromStudentwhereHeight>175--Total QueriesSelect COUNT(name) fromStudent--Check the number of people older than 24Select COUNT(*) fromStudentwhereAge> ---ORDER by sort default from small to largeSelect * fromStudentOrder by Age--Order desc from large to smallSelect * fromStudentOrder byAgedesc
Aggregation functions
--AVG AverageSelect AVG(age) asAverage age fromStudentSelect AVG(height) asAverage height fromStudent--sum sumSelect SUM(age) fromStudentSelect SUM(height) fromStudent--Max Maximum ValueSelect MAX(age) fromStudentSelect MAX(height) fromStudent--min min valueSelect MIN(age) fromStudentSelect MIN(height) fromStudent--Count Number--Total QueriesSelect COUNT(name) fromStudent--Check the number of people older than 24Select COUNT(*) fromStudentwhereAge> ---Group bySelectSex fromStudentGroup bySex--Gre=oup by have aggregation functionSelectSex fromStudentGroup bySex having COUNT(*)>5--modifying data in a tableUpdateStudentSetAge= - whereName='Shiren'
--Add a column Usez1p10320GoAlter TableStudentAddTizhongdecimal( -,1)--Delete a columnAlter TableStudentDrop columnTizhongSelectName as 'name' fromStudentwhereAge> -Select * fromStudentwhereAge> -
The current time distance which day is left how long is accurate to the second
function Time () {var date1=new Date (); Start time var date2=new Date (2016,3,30,0,0,0); End time Var date3=date2.gettime ()-date1.gettime ()///difference in milliseconds//calculates the difference in number of days Var Days=math.floor (date3/(24*3600*1000))// Calculates the number of hours var leave1=date3% (24*3600*1000)//calculates the number of days remaining after the number of milliseconds Var Hours=math.floor (leave1/(3600*1000))//calculates the difference in minutes var leave2= leave1% (3600*1000)//Calculate the number of milliseconds remaining after hours var Minutes=math.floor (leave2/(60*1000))//Calculate the difference in seconds var leave3=leave2% (60*1000) Calculates the number of milliseconds remaining after the number of minutes Var seconds=math.round (leave3/1000) var Qqqq=document.getelementbyid ("QQQQ"); Qqqq.innerhtml= "<FontColor= ' #FFFFFF ' Face= ' Classic coarse song Jane '>4/30 Pre-booked exclusive plan, then send 300 yuan And also</Font>"+days+"<FontColor= ' #FFFFFF ' Face= ' Classic coarse song Jane '>Days</Font>"+hours+"<FontColor= ' #FFFFFF ' Face= ' Classic coarse song Jane '>Hours<Font>"+minutes+"<FontColor= ' #FFFFFF ' Face= ' Classic coarse song Jane '>Score of</Font>"+seconds+"<FontColor= ' #FFFFFF ' Face= ' Classic coarse song Jane '>Seconds</Font>"; Window.settimeout ("Time ()", 1000);} Window.settimeout ("Time ()", 0)
SQL build table and query HTML COMPUTE time difference