SQL数据库题目哪有?

SQL数据库题目哪有?
09-10-11  xzerq 发布
5个回答
时间
投票
  • 0

    8182598

    1、创建数据库
    create database 学生成绩数据库
    on primary
    (name='学生成绩数据库_mdf',
    filename='e:\学生成绩数据库.mdb',
    size=1,
    maxsize=10,
    filegrowth =10%)
    log on
    (name='学生成绩数据库_ldf',
    filename='e:\学生成绩数据库.ldf',
    size=1,
    maxsize=10,
    filegrowth =10%)
    2、创建课程表
    create table 课程表
    (课程号 char(6) primary key,
    课程名称 char(20) not null,
    任课教师 char(8))
    3、 创建学生表
    create table 学生表
    (学号 char(6) primary key,
    姓名 char(8) not null,
    性别 char(2) constraint ck_性别 check( 性别 in ('男','女')),
    民族 char(20) not null default '汉')
    4、创建成绩表
    create table 成绩表
    (学号 char(6) not null foreign key(学号) references 学生表(学号),
    课程号 char(6) not null foreign key(课程号) references 课程表(课程号),
    分数 int constraint ck_分数 check(分数 between 0 and 150))
    5、添加信息
    insert 课程表(课程号,课程名)
    values ('100001', '大学语文')
    insert 课程表(课程号,课程名)
    values ('100002', '大学英语'

    09-10-12 | 添加评论 | 打赏

    评论读取中....

  • 0

    eia149

    1.

    select * from kc_rk1 inner join kc_rk2 on kc_rk1.rkid = kc_rk2.rkid where number > 15 and money <500;

    2.

    select code,money from kc_rk1,kc_rk2 where kc_rk1.rkid=kc_rk2.rkid and rkdcode='rkd20040501001';

    3.[如果是问总额的话]

    select sum(money) from kc_rk2

    4.

    update kc_rk1 set rkddata='2004-5-17' where rkdcode='rkd20040513009'

    09-10-13 | 添加评论 | 打赏

    评论读取中....

  • 0

    da434uq13

    1.

    select * from kc_rk1 inner join kc_rk2 on kc_rk1.rkid = kc_rk2.rkid where number > 15 and money <500;

    2.

    select code,money from kc_rk1,kc_rk2 where kc_rk1.rkid=kc_rk2.rkid and rkdcode='rkd20040501001';

    3.[如果是问总额的话]

    select sum(money) from kc_rk2

    4.

    update kc_rk1 set rkddata='2004-5-17' where rkdcode='rkd20040513009'

    09-12-28 | 添加评论 | 打赏

    评论读取中....

  • 0

    uqpypt

    第一题:
    USE [master]
    GO
    /****** 对象:  Database [dat]    脚本日期: 12/15/2008 21:49:23 ******/
    CREATE DATABASE [dat] ON  PRIMARY
    ( NAME = N'dat', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\DATA\dat.mdf' , SIZE = 51200KB , MAXSIZE = 102400KB , FILEGROWTH = 5120KB ),
    ( NAME = N'dat1', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\DATA\dat1.ndf' , SIZE = 51200KB , MAXSIZE = 102400KB , FILEGROWTH = 5120KB )
    LOG ON
    ( NAME = N'log1', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\DATA\log1.ldf' , SIZE = 20480KB , MAXSIZE = 51200KB , FILEGROWTH = 5120KB )
    GO
    EXEC dbo.sp_dbcmptlevel @dbname=N'dat', @new_cmptlevel=90
    GO
    IF (1 = FULLTEXTSERVICEPROPERTY('IsFullTextInstalled'))
    begin
    EXEC [dat].[dbo].[sp_fulltext_database] @action = 'disable'
    end
    GO
    ALTER DATABASE [dat] SET ANSI_NULL_DEFAULT OFF
    GO
    ALTER DATABASE [dat] SET ANSI_NULLS OFF
    GO
    ALTER DATABASE [dat] SET ANSI_PADDING OFF
    GO
    ALTER DATABASE [dat] SET ANSI_WARNINGS OFF
    GO
    ALTER DATABASE [dat] SET ARITHABORT OFF
    GO
    ALTER DATABASE [dat] SET AUTO_CLOSE OFF
    GO
    ALTER DATABASE [dat] SET AUTO_CREATE_STATISTICS ON
    GO
    ALTER DATABASE [dat] SET AUTO_SHRINK OFF
    GO
    ALTER DATABASE [dat] SET AUTO_UPDATE_STATISTICS ON
    GO
    ALTER DATABASE [dat] SET CURSOR_CLOSE_ON_COMMIT OFF
    GO
    ALTER DATABASE [dat] SET CURSOR_DEFAULT  GLOBAL
    GO
    ALTER DATABASE [dat] SET CONCAT_NULL_YIELDS_NULL OFF
    GO
    ALTER DATABASE [dat] SET NUMERIC_ROUNDABORT OFF
    GO
    ALTER DATABASE [dat] SET QUOTED_IDENTIFIER OFF
    GO
    ALTER DATABASE [dat] SET RECURSIVE_TRIGGERS OFF
    GO
    ALTER DATABASE [dat] SET  ENABLE_BROKER
    GO
    ALTER DATABASE [dat] SET AUTO_UPDATE_STATISTICS_ASYNC OFF
    GO
    ALTER DATABASE [dat] SET DATE_CORRELATION_OPTIMIZATION OFF
    GO
    ALTER DATABASE [dat] SET TRUSTWORTHY OFF
    GO
    ALTER DATABASE [dat] SET ALLOW_SNAPSHOT_ISOLATION OFF
    GO
    ALTER DATABASE [dat] SET PARAMETERIZATION SIMPLE
    GO
    ALTER DATABASE [dat] SET  READ_WRITE
    GO
    ALTER DATABASE [dat] SET RECOVERY FULL
    GO
    ALTER DATABASE [dat] SET  MULTI_USER
    GO
    ALTER DATABASE [dat] SET PAGE_VERIFY CHECKSUM  
    GO
    ALTER DATABASE [dat] SET DB_CHAINING OFF
    <strong>答案补充</strong>
    第二题:
    USE [dat]
    GO
    /****** 对象:  Table [dbo].[部门简况表]    脚本日期: 12/15/2008 21:52:03 ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    SET ANSI_PADDING ON
    GO
    CREATE TABLE [dbo].[部门简况表](
    [部分代号] [varchar](50) NULL,
    [部门名称] [varchar](50) NULL,
    [办公地点] [varchar](100) NULL
    ) ON [PRIMARY]GO
    SET ANSI_PADDING OFF
    --同理创建其它表<strong>答案补充</strong>
    第三题:
    --增加家庭地址“家庭地址”列
    alter table 教工情况表 add 家庭地址  varchar(100)
    --填充数据
    update 教工情况表 set 家庭地址='陕西' where 教工编号='001'<strong>答案补充</strong>
    第四题:
    grant all
    on 教工情况表
    to dbo

    09-12-28 | 添加评论 | 打赏

    评论读取中....

  • 0

    ccxkl85

    1.

    select * from kc_rk1 inner join kc_rk2 on kc_rk1.rkid = kc_rk2.rkid where number &gt; 15 and money &lt;500;

    2.

    select code,money from kc_rk1,kc_rk2 where kc_rk1.rkid=kc_rk2.rkid and rkdcode='rkd20040501001';

    3.[如果是问总额的话]

    select sum(money) from kc_rk2

    4.

    update kc_rk1 set rkddata='2004-5-17' where rkdcode='rkd20040513009'

    09-12-30 | 添加评论 | 打赏

    评论读取中....

精华知识
更多  
意见反馈 帮助