mysql语句 常用函数,js画图,在线调查系统2

 

摘要:mysql语句 常用函数,js画图,在线调查系统

创建库     mysql>create database 数据库名

显示库     mysql>show databases;

修改数据库 mysql>alter  database 数据库名

删除数据库 mysql>drop database 数据库名

创建表mysql>create table 表名

查看所有表mysql>show tables;

查看表的创建语句mysql>show create table 表名;

显示表结构mysql>desc 表名;

修改表名mysql>rename table 旧表名  to  新表名;

修改表字符集mysql>alter table 数据库名.表名  character set 字符集名;

添加字段mysql>alter table 表名 add 字段名 类型 first ;

mysql>alter table 表名 add 字段名 类型 after 列名 ;

数据库常用函数

数学函数:greatest() least() 获得一组数字的最大值和最小值

Floor() geiling()都用于取整,floor取小的,geiling取大

Round()四舍五入 truncate(num1,num2)保留num2位小数

Abs()取绝对值 sqrt()求平方根 pow(num1[底数],num2[指数])

Sin() cos() tan() 求正弦 余弦 正切值

聚合函数:Count(列名) 统计指定的列有多少条记录,不包括空值

Sum(id)计算该列数字之和

Avg计算该列的平均值

Max 计算该列的最大值

===============================================================

下面介绍js画图

<style>

 

div{

       height:1px; background-color:#ff0000; margin:auto;//画一条线,作为组成图形的元素

       }

</style>

 

<script language="javascript" type="text/javascript">

for(var i=0;i<300;i++){//使生成的线循环300次

 document.write("<div style='width:"+i+"px;'></div>");//每次循环增加一定的长度

}

</script>

=====================================================================

实现在线调查

我把我原来做的那个表单改了,以前那么写太乱了,自己都被搞糊涂了,这样写整齐点了,我设计了三个文件,一个页面,一个连接数据库,一个存放sql语句。如果可以,我会试试能不能用存储过程写这第三个文件,写出来我会接上的,敬请期待

<html>

<head>

<title>在线调查系统</title>

</head>

<body topmargin="0" background="bg.jpg" link="green" alink="green" vlink="green">

 

<h1 align="center">教师在线测评系统</h1>

<form action="" method="post" name="queslist">

<center>

课程<input type="text" name="kc" />

教师姓名<input type="text" name="name">

班级<input type="text" name="bj" />

</center>

<font face="楷体" size="+2" color="#FF0000">A为10分 B为8分 C为6分</font>

<p>该教师上课接打电话</p>

<input type="radio"/>A

<input type="radio"/>B

<input type="radio"/>C

<p>该教师对学生进行体罚</p>

<input type="radio"/>A

<input type="radio"/>B

<input type="radio"/>C

<p>该教师与学生互动情况</p>

<input type="radio"/>A

<input type="radio"/>B

<input type="radio"/>C

<p>该教师对学生的问题是否乐于解答</p>

<input type="radio"/>A

<input type="radio"/>B

<input type="radio"/>C

<p>该教师对同学是否友善</p>

<input type="radio"/>A

<input type="radio"/>B

<input type="radio"/>C

<p>该教师作风是否正直</p>

<input type="radio"/>A

<input type="radio"/>B

<input type="radio"/>C

<p>该教师对课外知识的拓展情况</p>

<input type="radio"/>A

<input type="radio"/>B

<input type="radio"/>C

<p>该教师佩戴首饰,浓妆艳抹</p>

<input type="radio"/>A

<input type="radio"/>B

<input type="radio"/>C

<p>该教师在工作时间早退情况</p>

<input type="radio"/>A

<input type="radio"/>B

<input type="radio"/>C

<p>该教师按时批改作业,并点评</p>

<input type="radio"/>A

<input type="radio"/>B

<input type="radio"/>C<br>

<input type="submit" value="提交" name="tj" align="middle">

<input type="submit" value="重置" name="cz">

 

</form>

</body>

</html>

数据库正在研究中,不知道到底应该用几个字段来存储ABC,如果要返回平均值的话sql语句的书写也是个问题,看来明天交上作业是很困难了。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值