stack:
int main(){
int x=1,y=2;
int z[]={100,200};
z[0]=300;
z[2]=400;
printf(“%d\n”,x,y);
}
window平台运行结果( )
SQL:DDL DML DCL
数据类型:
数值型 int/float number/decimal/numeric
111 ‘111’
字符型 char varchar 单引号表示字符串
111 ‘111’
日期型(特殊的字符)
‘’
大字段型 clob/blob/text/image
create table 表的名称(
字段/列名称 数据类型,
。。。。。
a int );
数据约束关键字
not null default check unique
primary key foreign key
not null default
SQL>create table test1(
a int , b int not null,c int default 100);
SQL>insert into test1(a) values(1); 执行结果
SQL>insert into test1(b) values(1); 执行结果
SQL>select * from test1 where a=0;
SQL>select * from test1 where a is null;
SQL>select c,b,a from test1;
check unique
SQL>create Table test2(
a int unique,
b int unique,
c number(2) check (c>=18 and c<=60) );
SQL>通过增加数据,确定a的取值,c的取值
SQL>
primary key foreign key
SQL>create table test3(
a int primary key,b char(10) );
SQL>insert into test3 (b) values(‘aaa’);
SQL>insert into test3(a) values(1);执行两次
SQL>create table test4(a int primary key,
b int primary key);
说说primary key和unique区别?
SQL> create table test5(a int,
b int , primary key(a,b));
SQL>a b
- NULL
- 1
1 2
SQL>insert into sc values(100,100,100);
SQL>根据表sc,生成一个备份表sc_bak(表中不要有数据)
SQL>where sid<-100; 或 where 2<1;
foreign key
SQL>sc中不应该存在100(学号) 100(课程号) 100数据,为什么?
SQL>create table sc2 (sid int,cid int,score float,
primary key(sid,cid),
foreign key (sid) references student(sid));
SQL>insert into sc2 values(100,100,100);
数据库范式:
第一范式: 表的字段名称不能相同
第二范式:表定义了主键
第三范式:有外键约束
SQL: query
运算符号:
+ - * / and or between …and in like
SQL>将sc中不及格的信息、增加到sc_bak中
insert into dd () 查询的数据
SQL>insert into sc_bak select * from sc where score<60;
SQL>select * from sc_bak;
SQL>insert into sc_bak(cid,sid,score)
select cid,sid,score from sc where score>=60;
SQL>select * from sc_bak;
SQL>select sid 学号,cid 课程号,’A’ 等级
from sc_bak where score>=90;
SQL> select sid 学号,cid 课程号,’B’ 等级
from sc_bak where score>=70 and score<90;
SQL> select sid 学号,cid 课程号,’C’ 等级
from sc_bak where score>=60 and score<70;
SQL>select sid 学号,cid 课程号,’D’ 等级
from sc_bak where score<60;
主机,用记事本,编写文件lm.java
class Student{
int sid;
String sname;
int sage;
String ssex;
}
class Lm{
public static void main(String …args){
Student 刘敏=null;
Student 王[]=new Student[2];
System.out.println(王[1]);
System.out.println(王[1].sid);
}
}
命令行运行( )
SQL>create table aaa(a number(4,2));
SQL>insert into aaa values(100.2);
SQL>insert into aaa values(99.991);
SQL>insert into aaa values(99.9);
SQL>insert into aaa values(-99.991);
SQL>select * from aaa;
课后实践
1 结合某个应用场景设计数据库
数据库设计的时候,需关注的数据约束关键字
not null unique default check
primary key foreign key
2查询(用scott连接数据库,desc emp)
用户scott已存在,emp表已存在
- 查询工资(SAL)大于1000的雇员的所有信息?
- 查询1981年以后入职员工的姓名(ENAME)、职位(JOB)、入职日期(HIREDATE)、工资(SAL)?
- 将员工的姓名(ENAME)与职位(JOB)以”—”连接在一起显示?
- 查询员工的姓名(ENAME) 、职位(JOB)、加上200的工资(SAL)?
- 查询员工的工号(EMPNO)、姓名(ENAME) 、职位(JOB)、薪水?注:薪水=工资(SAL) + 奖金(COMM)
- 查询所有工资(SAL)在1000-2000之间的员工信息
- 查询所有职位(JOB)为manger或是工资(SAL)大于500的雇员,同时还要满足他们的姓名首字母是大写的J?
- 查询部门号(DEPTNO)为20和30的员工?
- 查询员工姓名(ENAME)第二个字母为L的员工?
- 所有的员工信息按照部门号(DEPTNO)升序而雇员的工资(SAL)降序进行排列?
- 查询所有员工的工号 (EMPNO)、姓名(ENAME)、年收入?注:年收入计算方式为奖金(COMM)加上13个月的工资(SAL)
3在纸质本子上,回答下列问题
说说C/S,并举例(我们使用过的)
说说常用网络命令,并描述命令作用
说说tcp和udp区别,用什么命令可以查看区别
unix/linux字符界面光盘如何使用
vi中如何复制粘贴,如何查找替换
数据库a int 和java或c的int a的区别
第三范式是什么
unix/linux用什么命令可以查找ip地址信息存储在哪个文件(假定不知道文件名称和位置)
4 打字练习(菜鸟教程)

本文深入探讨了SQL语言的基础操作,包括DDL、DML、DCL等,详细讲解了数据类型的使用,表的创建及数据约束关键字。同时,介绍了C语言的基本语法,如变量声明、数组操作以及条件判断,通过具体代码示例展示了语言特性。
1万+

被折叠的 条评论
为什么被折叠?



