04 2015 档案

摘要:create database 数据库/*数据库的服务、数据库文件、*/--修改表添加列create table biao(name varchar(50))alter table biao add sex varchar(20) --往表里增加一列alter table biao drop col... 阅读全文
posted @ 2015-04-30 10:03 XCml 阅读(311) 评论(0) 推荐(0) 编辑
摘要:--范式理论(数据库设计三范式)--1.列里面数据要单一--2.一个表必须要有一个主键--3.外键表中只出现主键表中的主键列就好了,其他列就不要出现了/*当一个表中,出现了3列及以上的数据经常重复出现多次的情况的时候,就需要把这些列拿出来单独建立一个表,设一个主键,然后在原来表中只出现主键就可以了*... 阅读全文
posted @ 2015-04-29 22:50 XCml 阅读(200) 评论(0) 推荐(0) 编辑
摘要:---事务:保障整个流程的完整执行,全部没有问题,统一提交,一旦有问题,回到原点。begin tran --事务的开始--开始写流程语句--语句写完之后if @@ERROR>0beginrollback tran--回滚事务endelsecommit tran --提交事务--级联删除套入事务中al... 阅读全文
posted @ 2015-04-29 22:49 XCml 阅读(143) 评论(0) 推荐(0) 编辑
摘要:alter trigger studentchufa_deleteon studentchufainstead of deleteas declare @count int select @count=count(*)from deleted declare @i int s... 阅读全文
posted @ 2015-04-29 22:48 XCml 阅读(122) 评论(0) 推荐(0) 编辑
摘要:--触发器:触发器就是一种特殊的存储过程--特殊的地方在于,触发器是通过对数据库表的操作,来引发--存储过程是通过人为exec来执行select*from studentcreate trigger student_insert --创建触发器on student --指定触发器所在的表for In... 阅读全文
posted @ 2015-04-29 15:26 XCml 阅读(313) 评论(0) 推荐(0) 编辑
摘要:--累加求和存储过程alter proc LeiJiaQiuHe1 @num int--输入参数asdeclare @sum intdeclare @i intset @sum=0set @i=1while @i<=@num begin set @sum=@sum+@i set @... 阅读全文
posted @ 2015-04-28 11:12 XCml 阅读(763) 评论(0) 推荐(0) 编辑
摘要:--约束:对列的值起一个约束性的作用,规定列的值的范围--主键、外键、非空、自增长标识列、唯一列(unique)、check约束--check 约束--在某个表里点击右键→设计→进去找到要约束的列点击右键→添加→写表达式(表达式必须以列名开头) 阅读全文
posted @ 2015-04-28 11:04 XCml 阅读(500) 评论(0) 推荐(0) 编辑
摘要:--数据库的备份、还原--备份--在对应数据库右键→任务→备份→直接点确定 .bak结尾--还原--在数据库右键→还原数据库→目标数据库(起别名),点击源设备→添加所备份的.bak文件--分离、附加--分离 分离出来可以拷贝走 .mdf文件--在对应数据库右键→任务→分离→删除连接→确定 ... 阅读全文
posted @ 2015-04-28 10:57 XCml 阅读(152) 评论(0) 推荐(0) 编辑
摘要:--创建万能分页alter proc wannengfenye11@nowye int,@numbers int,@tablename varchar(50),@zhujian varchar(50)as必须要用字符串连接起来,不然系统识别不出@tablenameexec ('select top(... 阅读全文
posted @ 2015-04-28 10:43 XCml 阅读(149) 评论(0) 推荐(0) 编辑
摘要:--视图:视图就是一个虚拟的表select *from view_1--显示所有学生的sno、sname、cno、degreeselect Student.Sno,sname,cno,degree from Student join Score on Student.Sno=Score.sno --... 阅读全文
posted @ 2015-04-27 20:28 XCml 阅读(199) 评论(0) 推荐(0) 编辑
摘要:create database Fruitcreate table fruit(Ids varchar(50),Name varchar(50),Price decimal(18,2),Source varchar(50),Stack int,Numbers int,Image varchar(50... 阅读全文
posted @ 2015-04-27 11:09 XCml 阅读(627) 评论(0) 推荐(0) 编辑
摘要:--定义变量 定义,赋值,显示 三个必须一块执行declare @bianliang int--定义变量 set @bianliang=12--变量赋值select @bianliang --显示--定义两个变量求和declare @bianliang1 int ,@bianliang2 intse... 阅读全文
posted @ 2015-04-26 23:16 XCml 阅读(203) 评论(0) 推荐(0) 编辑
摘要:--27、查询出“计算机系“教师所教课程的成绩表。select * from Score where Cno in(select Cno from Course where Tno in(select tno from Teacher where Depart='计算机系'))--28、查询“计算... 阅读全文
posted @ 2015-04-25 22:23 XCml 阅读(281) 评论(0) 推荐(0) 编辑
摘要:--17、 查询“95033”班学生的平均分。select avg(degree) from Score where Sno in (Select Sno from Student where Class=95033)--18、 假设使用如下命令建立了一个grade表:现查询所有同学的Sno、Cno... 阅读全文
posted @ 2015-04-23 18:55 XCml 阅读(323) 评论(0) 推荐(0) 编辑
摘要:create database 作业use 作业--创建学生表create table Student(Sno char(3) primary key not null,Sname char(8) not null,Ssex char(2) not null,Sbirthday datetime ... 阅读全文
posted @ 2015-04-22 11:20 XCml 阅读(254) 评论(0) 推荐(0) 编辑
摘要:create table yyy(code int ,name varchar(50),sex varchar(50),age int,hight decimal(18,1),weight decimal(18,1),idno bigint,address varchar(50))insert in... 阅读全文
posted @ 2015-04-20 22:01 XCml 阅读(182) 评论(0) 推荐(0) 编辑
摘要:namespace 输入一个年份是否为闰年{ class Program { static void Main(string[] args) { while (true) { Console.WriteLine("请输入年份:"); int a = Convert.ToInt32(Console.R... 阅读全文
posted @ 2015-04-19 20:30 XCml 阅读(164) 评论(0) 推荐(0) 编辑
摘要:create database k20150419 --创建一个名为k20150419的数据库go --连接符use k20150419 --使用k20150419这个数据库gocreate table practice --创建一个名为practice的表(tno int primary key ... 阅读全文
posted @ 2015-04-19 20:20 XCml 阅读(204) 评论(0) 推荐(0) 编辑
摘要:select*fromxinxibiaowherehigh>163andsex='男'updatexinxibiaosetname='约里克'wherename='刘凯'--betweenand在什么和什么之间select*fromxinxibiaowherehighbetween165and175... 阅读全文
posted @ 2015-04-18 20:44 XCml 阅读(187) 评论(0) 推荐(0) 编辑
摘要:二、第二课createtableteacher(tnointprimarykeyidentity(1,1),--将tno设为主键(primarykeyidentity(1,1))tnamevarchar(50))goinsertintoteachervalues('张三')insertintotea... 阅读全文
posted @ 2015-04-17 18:50 XCml 阅读(249) 评论(0) 推荐(0) 编辑
摘要:createdatabases20150417--创建数据库, 数据库的名字不能纯数字createdatabase漩涡鸣人dropdatabase漩涡鸣人--删除数据库use漩涡鸣人--使用数据库go--连接符createtablexuesheng--创建表(codeintnotnull,namev... 阅读全文
posted @ 2015-04-17 18:31 XCml 阅读(176) 评论(0) 推荐(0) 编辑
摘要:namespace 运算符穷举{ class Program { static void Main(string[] args) { //123()45()68=100; 在括号里面添加+-使等式成立 int a; int b; for (int i = 0; i < 2; i++)//有0 和... 阅读全文
posted @ 2015-04-15 22:46 XCml 阅读(135) 评论(0) 推荐(0) 编辑
摘要:namespace 兔子生兔子函数递归{ class Program { static void Main(string[] args) { Console.WriteLine("请输入你想知道兔子哪个月的数量:"); int m = Convert.ToInt32(Console.ReadLine... 阅读全文
posted @ 2015-04-15 22:42 XCml 阅读(710) 评论(0) 推荐(0) 编辑
摘要:namespace 找到一段话中第二个关键字的位置{ class Program { static void Main(string[] args) { //找第二个a string s = "cabcaceadf"; int n = s.IndexOf("a"); //找到第一个a的索引n str... 阅读全文
posted @ 2015-04-15 22:39 XCml 阅读(152) 评论(0) 推荐(0) 编辑
摘要:namespace 赶羊递归 { class Program { public int jisuan(int day) //创建一个函数,输入day计算出羊的总数 { int sum=0; if(day==7) { sum = 2; return sum; //一定要加return截止 } su... 阅读全文
posted @ 2015-04-15 22:36 XCml 阅读(201) 评论(0) 推荐(0) 编辑
摘要:namespace 函数数组排序带出最大最小值及平均值{ class Program { static void Main(string[] args) { int[] b=new int[]{9,1,5,3,7}; int max = 0; //设置两个变量用来接收最低值与最小值。 int mi... 阅读全文
posted @ 2015-04-14 00:19 XCml 阅读(293) 评论(0) 推荐(0) 编辑
摘要:namespace 一元二次方程函数解决{ class Program { static void Main(string[] args) { while (true) { Console.WriteLine("请为一元二次方程ax²+bx+c设置相关参数:"); Console.WriteLin... 阅读全文
posted @ 2015-04-14 00:09 XCml 阅读(337) 评论(0) 推荐(0) 编辑
摘要:namespace 函数__青歌赛打分{ class Program { public int[] Array(int[] a) //排序 { int n = a.Length; for (int i = 1; i <= a.Length; i++) { for (int j = 1; j <= a... 阅读全文
posted @ 2015-04-14 00:03 XCml 阅读(171) 评论(0) 推荐(0) 编辑
摘要:namespace 随机生成手机号{ class Program { static void Main(string[] args) { while (true) { long[] array = new long[10]{13581049314,18366885682,13626435731,1... 阅读全文
posted @ 2015-04-13 23:41 XCml 阅读(395) 评论(0) 推荐(0) 编辑
摘要:using System;using System.Collections.Generic;using System.Text;using System.Threading;namespace 用函数把闹钟习题练一练无返回值{ class Program { public void naozhong... 阅读全文
posted @ 2015-04-12 21:35 XCml 阅读(210) 评论(0) 推荐(0) 编辑
摘要:namespace 函数冒泡排序{ class Program { static void Main(string[] args) { int[] b = new int[5] { 1,5,3,4,2}; new Program().Array(b); //数组b调用已经写好的Array函数用来排... 阅读全文
posted @ 2015-04-12 21:33 XCml 阅读(170) 评论(0) 推荐(0) 编辑
摘要:namespace 函数{ //函数的作用:提高代码的重用性,一块封闭的代码块。 //语法结构:返回值(当执行完函数之后,返回的结果的数据类型),函数名,输入参数,输出参数,函数体。 //一:无返回值,无参数的函数 /* public void dayin() //只是调用,不需要返回值 { Con... 阅读全文
posted @ 2015-04-12 21:31 XCml 阅读(255) 评论(0) 推荐(0) 编辑
摘要:namespace 火影忍者多人对战{ class Program { //创建一个Player的结构体 struct Player { public string name; public int hp; public int attack; public int defend; public i... 阅读全文
posted @ 2015-04-10 19:05 XCml 阅读(360) 评论(0) 推荐(0) 编辑
摘要:namespace 商场打折结构体{ class Program { struct ZhuangBei { public string name; public double price; public int amount; } static void Main(string[] args) {... 阅读全文
posted @ 2015-04-10 19:03 XCml 阅读(128) 评论(0) 推荐(0) 编辑
摘要:using System;using System.Collections;using System.Collections.Generic;using System.Text;namespace 结构体冒泡排序{ class Program { struct student { public st... 阅读全文
posted @ 2015-04-10 19:02 XCml 阅读(469) 评论(0) 推荐(0) 编辑
摘要:using System;using System.Collections;using System.Collections.Generic;using System.Text;namespace ArrayList集合排序{ class Program { struct Player { publ... 阅读全文
posted @ 2015-04-10 19:00 XCml 阅读(302) 评论(0) 推荐(0) 编辑
摘要:namespace 英雄联盟对战{ class Program { struct player { public string name; public int hp; public int gj; public int fy; public int dj; public jn jineng; /... 阅读全文
posted @ 2015-04-08 21:58 XCml 阅读(181) 评论(0) 推荐(0) 编辑
摘要:namespace 结构体英雄联盟练一练{ class Program { struct player { public string name; public int dengji; public zy z; public zb cz; } struct zy { public int ll; p... 阅读全文
posted @ 2015-04-08 21:56 XCml 阅读(138) 评论(0) 推荐(0) 编辑
摘要:namespace 结构体_枚举类型{ class Program { struct jiegouti { public int fenshu; public string name; public string kecheng; } static void Main(string[] args) ... 阅读全文
posted @ 2015-04-08 21:54 XCml 阅读(120) 评论(0) 推荐(0) 编辑
摘要:namespace ArrayList集合的语句示例{ class Program { static void Main(string[] args) { //一:Stack集合(没有索引) 先进后出,一个一个赋值,一个一个取值,按顺序 //Stack ss = new Stack(); //ss.... 阅读全文
posted @ 2015-04-08 21:53 XCml 阅读(208) 评论(0) 推荐(0) 编辑
摘要:namespace 刘老师双色球{ class Program { static void Main(string[] args) { int count = 0; Console.WriteLine("请输入你的双色球号码"); ArrayList Ual = new ArrayList(); f... 阅读全文
posted @ 2015-04-08 21:49 XCml 阅读(202) 评论(0) 推荐(0) 编辑
摘要:namespace 集合与特殊集合{ class Program { static void Main(string[] args) { ArrayList al = new ArrayList(); al.Add("李青"); al.Add("约里克"); al.Add("安妮"); al.Add... 阅读全文
posted @ 2015-04-08 21:48 XCml 阅读(219) 评论(0) 推荐(0) 编辑
摘要:namespace 集合习题练一练{ class Program { static void Main(string[] args) { Console.WriteLine("请输入你们班的人数:"); int n = Convert.ToInt32(Console.ReadLine()); Arr... 阅读全文
posted @ 2015-04-08 21:47 XCml 阅读(189) 评论(0) 推荐(0) 编辑
摘要:namespace 集合__双色球练一练{ class Program { static void Main(string[] args) { // while (true) // { // ArrayList al = new ArrayList(); // al.Add(1); al.Add(... 阅读全文
posted @ 2015-04-08 21:46 XCml 阅读(424) 评论(0) 推荐(0) 编辑
摘要:namespace 刘老师推箱子{ class Program { static int kkk1, kkk2; static void Main(string[] args) { int x = 1, y = 1, i = 0; int[, ,] dt = new int[2, 10, 10] ... 阅读全文
posted @ 2015-04-08 21:42 XCml 阅读(163) 评论(0) 推荐(0) 编辑
摘要:for (int i = 1; i <a.Length; i++){ for (int j = 1; j <=a.Length-i; j++) { if (a[j-1]<a[j])//位置交换 { temp=a[j-1]; a[j-1]=a[j]; a[j]=temp; } }} 阅读全文
posted @ 2015-04-06 00:08 XCml 阅读(107) 评论(0) 推荐(0) 编辑
摘要:namespace 自己琢磨推箱子{ class Program { static void Main(string[] args) { //定义一个地图 int x=2,y=1;//小人的位置 int temp = 0; int[,] map = new int[10, 10] { {1,1,... 阅读全文
posted @ 2015-04-05 23:51 XCml 阅读(201) 评论(0) 推荐(0) 编辑
摘要:namespace index{ class Program { static void Main(string[] args) { while (true) { string s = "abcdefghijklmn"; int i = s.IndexOf("f"); // i是f在字符串s中的位置... 阅读全文
posted @ 2015-04-02 21:11 XCml 阅读(205) 评论(0) 推荐(0) 编辑
摘要:namespace yyyy_MM_dd_hh_mm{ class Program { static void Main(string[] args) { while (true){ try { Console.WriteLine("请输入您的出生年月日"); DateTime dt = Conve... 阅读全文
posted @ 2015-04-02 20:39 XCml 阅读(835) 评论(0) 推荐(0) 编辑
摘要:namespace 随机生成验证码{ class Program { static void Main(string[] args) { while (true) { string s = "abcdefghijklmnopqrstuvwxyz"; string t = "李青用强力的回旋踢击退地方... 阅读全文
posted @ 2015-04-02 20:21 XCml 阅读(195) 评论(0) 推荐(0) 编辑
摘要:static void Main(string[] args) { while (true) { Console.WriteLine("请输入一段英文:"); string s = Console.ReadLine(); int x = s.Length; //x代表字符的长度 for (int ... 阅读全文
posted @ 2015-04-02 19:35 XCml 阅读(105) 评论(0) 推荐(0) 编辑
摘要:static void Main(string[] args) { while (true) { Console.WriteLine("请输入您的年份"); int x = Convert.ToInt32(Console.ReadLine()); try { DateTime y = Conve... 阅读全文
posted @ 2015-04-02 19:31 XCml 阅读(131) 评论(0) 推荐(0) 编辑
摘要:static void Main(string[] args) { string a; Console.WriteLine("请输入您的邮箱地址:"); a = Console.ReadLine(); if (a.Contains("@")&&a.Contains(".com"))//这句话的意思是... 阅读全文
posted @ 2015-04-02 19:28 XCml 阅读(260) 评论(0) 推荐(0) 编辑
摘要:static void Main(string[] args) { DateTime dt = DateTime.Now; Console.WriteLine(dt); DateTime nz = Convert.ToDateTime("2015-4-2 17:00"); //将nz的时间转换为电... 阅读全文
posted @ 2015-04-02 19:25 XCml 阅读(127) 评论(0) 推荐(0) 编辑
摘要:static void Main(string[] args) { string s = ""; s = "★\n★★\n★★★\n★★★★\n★★★★★"; Console.WriteLine(s); Console.ReadLine(); } 阅读全文
posted @ 2015-04-02 19:21 XCml 阅读(134) 评论(0) 推荐(0) 编辑
摘要:static void Main(string[] args) { int y = 2; //过一个村庄丢一半零一只,过了7个村庄还是2只,求原来几只 for (int i = 1; i <=7; i++) { y = (y + 1) * 2; } Console.WriteLine(y); Con... 阅读全文
posted @ 2015-04-02 19:20 XCml 阅读(105) 评论(0) 推荐(0) 编辑
摘要:static void Main(string[] args) { while (true) { /* string x; Console.WriteLine("请随便输入:"); x= Console.ReadLine(); x=x.Trim();//前边的空格和后面的空格都去掉 Consol... 阅读全文
posted @ 2015-04-02 19:18 XCml 阅读(91) 评论(0) 推荐(0) 编辑
摘要:static void Main(string[] args) { while (true) { int i=1; while (i<=100) { Console.WriteLine(i); i++; if (i==50) { Console.WriteLine("sdsa"); } c... 阅读全文
posted @ 2015-04-02 19:15 XCml 阅读(105) 评论(0) 推荐(0) 编辑
摘要:static void Main(string[] args) { int n = 0; for (int x = 1; x*15 <=200; x++) {可能性*可能性*可能性=全部可能性,从中找出符合条件的就OK(if); for (int y = 1; y*3 <=200; y++) { f... 阅读全文
posted @ 2015-04-02 19:10 XCml 阅读(107) 评论(0) 推荐(0) 编辑
摘要:static void Main(string[] args) { while (true) { /*★ ★★ //最重要的就是找规律 i--行 ★★★ j--列 ★★★★ ★★★★★ */ /*string s = "★"; int n; Console.WriteLine("请输入一个数:... 阅读全文
posted @ 2015-04-02 19:08 XCml 阅读(205) 评论(0) 推荐(0) 编辑
摘要:static void Main(string[] args) { while (true) { try { Console.Write("请输入一个数:"); int n = Convert.ToInt32(Console.ReadLine()); int i = 1; int s = 0, z... 阅读全文
posted @ 2015-04-02 19:06 XCml 阅读(1174) 评论(0) 推荐(0) 编辑
摘要:static void Main(string[] args) { while (true) { int n = 0; for (int g = 1; g*2 <=100; g++) { for (int m = 1; m*1 <=100; m++) { for (int x = 1; x*0.5... 阅读全文
posted @ 2015-04-02 19:05 XCml 阅读(123) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示