使用JDBC连接数据库 (9)

insert into(id,masterid,name,health,lover,type,grade) values()

--创建序列

create sequence dragonid_sequ

increment by 1

start with 10000

nomaxvalue

nocycle

cache 10;

 

 

--查询表

select * from dragon

 

--删除表

drop table   dragon

 

1.2 SQL Server 中创建PetDB数据库 和 Dragon

 

--创建PetDB数据库

create database StudentDB

on primary--主文件组

(

--数据库文件的逻辑名称,不能重复

name=\'PetDB\',

--数据库物理文件名(绝对路径)

filename=\'E:\PetDB.mdf\',

--数据库文件初始大小

size=10MB,

--数据文件增长量

filegrowth=1MB

)

log on

(

--日志文件的逻辑名称,不能重复

name=\'PetDB_log\',

--日志物理文件名(绝对路径)

filename=\'E:\PetDB_log.ldf\',

--日志文件初始大小

size=3MB,

--日志文件增长量

filegrowth=1MB

)

go

--创建Dragon

create table Dragon(

id numeric(5, 0)identity(1,1)  primary key not null,

masterid numeric(5, 0) ,

name varchar(10) ,

health numeric(3, 0),

lover numeric(3, 0),

type varchar(10),

grade varchar(10)

)

 

1.3 MySql中创建PetDB数据库 和 Dragon

创建数据库

 CREATE DATABASE `PetDB`

创建表

CREATE TABLE `dragon` (

`id` int(11) NOT NULL AUTO_INCREMENT,  

`masterId` int(11) DEFAULT NULL,

`name` varchar(45) DEFAULT NULL,

`health` int(11) DEFAULT NULL,

`lover` int(11) DEFAULT NULL,

`type` varchar(45) DEFAULT NULL,

 `grade` varchar(45) DEFAULT NULL,

 PRIMARY KEY (`id`))

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/zzdxfz.html