摘要:
select * from Students where Address IS null --判断address是nulselect * from Students where Address is not null --判断address不为nullselect name,ISNULL([address],'地球')from Students--如果有出现null就让其显示地球(要注意其数据类型) 阅读全文
摘要:
declare @name int =1select @name =COUNT (id) from Students if(@name>10) begin print '人好多啊' endelse begin print '人好少啊' end--------------------------------if((select COUNT (id) from Students) >10) --表达式可以是一个返回一行一列的结果集 begin print '人好多啊' endelse begin print '人好少啊' 阅读全文
摘要:
--第一种不对任何列caseselect Id,English,casewhen English =60 then '及格' --大于等于六十输出及格end as 成绩from score--第二种直接对列caseselect case Idwhen 1 then '家人'when 2 then '同事'when 3 then '同学'endfrom PhoneTypeselect case Idwhen 1 then '家人'else '朋友' endfrom PhoneType 阅读全文
摘要:
--区分大小写性能比较低select * from Students where Age >1 and Age <4select * from Students where Age between 1 and 4--取出一到四的数据包含一和四(between在数据库有优化,性能比较好,高于上面的语句)select * from Students where Age in(1,2,3)--查询出年龄包含1,2,3的数据select * from Students where Name like 'a%' --以a开头的后面不管有几个字符都可以匹配select * fr 阅读全文
摘要:
@using PagedList.Mvc;@model PagedList.IPagedList@{ Layout = null;} Index //记得引用这个css文件 ID 姓名 地址 @foreach (var item in Model) { @Html.DisplayFor(modelItem => item.Id) @Html.DisplayFor(modelItem => item.Name) @Html.DisplayFor(modelItem => item.Address) } @Html.PagedListPager(Model, p... 阅读全文