是否有LinqPad简明数据库的SQLite版本 [英] Is there a SQLite version of the LinqPad nutshell database

查看:56
本文介绍了是否有LinqPad简明数据库的SQLite版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用LINQPad学习LINQ,但是事实是我有一本笔记本.

I am trying to learn LINQ with LINQPad, but the fact is that I have a notebook.

因此,我不想在上面安装SQL Server(我什至不认为自己可以安装SQL Server).

Therefore, I don't want to install SQL Server on it (I am not even conviced that I could do it).

一些LINQPAD示例使用一个名为nutshell.mdf的数据库,我想知道是否可以找到该数据库的SQLite版本,以及在哪里?

Some LINQPAD Examples use a database called nutshell.mdf, I'd like to know if I can find a SQLite version of this database, and where?

推荐答案

没有SQLite版本,但是您可以轻松地创建SQL CE版本.SQL CE相当轻巧,不会使您的笔记本陷入困境.LINQPad支持SQL CE:单击添加连接",选择LINQ to SQL,单击SQL CE并告诉它创建数据库,然后单击确定".然后运行"SQL"类型的查询以创建模式-以下脚本将创建Nutshell示例数据库:

There's no SQLite version, but you can create a SQL CE edition easily enough. SQL CE is fairly lightweight and won't bog down your notebook. LINQPad supports SQL CE: click "Add Connection", choose LINQ to SQL, click SQL CE and tell it to create a database, and click OK. Then run a query of type 'SQL' to create the schema - the following script will create the Nutshell sample database:

create table Customer
(
    ID int not null primary key,
    Name nvarchar(30) not null
)
go
create table Purchase
(
    ID int not null primary key,
    CustomerID int null references Customer (ID),
    Date datetime not null,
    Description nvarchar(30) not null,
    Price decimal not null
)
go
create table PurchaseItem
(
    ID int not null primary key,
    PurchaseID int not null references Purchase (ID),
    Detail nvarchar(30) not null,
    Price decimal not null
)
go
create table MedicalArticles
(
    ID int not null primary key,
    Topic nvarchar (20),
    Abstract nvarchar (2000)    
)
go
create table Product
(
    ID int not null primary key,
    Description nvarchar(30) not null,
    Discontinued bit not null,
    LastSale datetime not null
)
go
insert Customer values (1, 'Tom')
go
insert Customer values (2, 'Dick')
go
insert Customer values (3, 'Harry')
go
insert Customer values (4, 'Mary')
go
insert Customer values (5, 'Jay')
go
insert Purchase values (1, 1, '2006-1-1', 'Bike', 500)
go
insert Purchase values (2, 1, '2006-1-2', 'Holiday', 2000)
go
insert Purchase values (3, 2, '2007-1-3', 'Bike', 600)
go
insert Purchase values (4, 2, '2007-1-4', 'Phone', 300)
go
insert Purchase values (5, 3, '2007-1-5', 'Hat', 50)
go
insert Purchase values (6, 4, '2008-1-6', 'Car', 15000)
go
insert Purchase values (7, 4, '2008-1-7', 'Boat', 30000)
go
insert Purchase values (8, 4, '2008-1-8', 'Camera', 1200)
go
insert Purchase values (9, null, '2008-1-9', 'Jacket', 80)
go
insert PurchaseItem values (1, 2, 'Flight', 1500)
go
insert PurchaseItem values (2, 2, 'Accommodation', 500)
go
insert PurchaseItem values (3, 2, 'Camera', 400)
go
insert MedicalArticles values (1, 'Influenza', '<this is the abstract...>')
go
insert MedicalArticles values (2, 'Diabetes', '<this is the abstract...>')
go
insert Product values (1, 'Widget', 0, '2007-1-1')

这篇关于是否有LinqPad简明数据库的SQLite版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆