chapter查寻数据(Chapter search data).docVIP

  • 3
  • 0
  • 约8.62千字
  • 约 19页
  • 2018-06-05 发布于江西
  • 举报
chapter查寻数据(Chapter search data).doc

chapter2查寻数据(Chapter2 search data) Single line notes Multi line comment / * * / The first step: create database niitdb / * Database file contains: Master data file: niitdb.mdf Log file: niitdb_log.ldf The second step is to separate database, add database, backup and restore database Establishing D:\Datsbase Third steps: Create student table StuNo StuName age sex address Common data types: Values: int 1,2,3............ Short numerical type: smallInt Long numerical type: bigInt Decimal point (floating point, single precision):float--3.14 Double precision: double--3.1415926533348 Character type: char--a,b,1 String: string-- abkei Sql: structured query language (struct query language) Server: (service) P1.4 Business procedures may have three elements ………… * / -- execute the SQL statement --1, using database Grammar: --use database --go Example: Use niitdb Go Select * From Student A set of custom columns, column chart, header information (three kinds) --select column names 1, column names 2, column names 3,... Names n --from table name Select StuNo as ID , name address= StuName address From dbo.Student - two, connector characters Select Student.StuNO, Student.StuName, , Student.sex = description of gender: From Student INT turns into CHAR:convert function Select StuName+age:+CONVERT (char (4), age) + old + as description address:+address From Student Select StuName+age:+CONVERT (char (4), age) + old + minus 10 years after+CONVERT (char (4), age-10) + as description address:+address From Student Any number and ratio of numerical values, the result is itself. Select StuName+age:+CONVERT (char (4), age%300) + old + as description address:+address From Student Select specific rows --1, comparison operator Not equal to =! Select * from Student where age=30 Select * from Student where age30 --2, arithmetic operator - + - * /% /*3, logical operator Not and and or / or negative Select * from Student Where StuName=jordanand age 40 Select * from Student Where StuName=jordanor St

您可能关注的文档

文档评论(0)

1亿VIP精品文档

相关文档