如何在MS-SQL Server 2005中创建表 [英] how to create table in ms-sql server 2005

查看:74
本文介绍了如何在MS-SQL Server 2005中创建表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

它基本上是一个服务项目(即自行车保险,电话账单,信用卡账单),所有这些账单详细信息和金额都将提供给一家小公司.该公司将支付相关费用.

在这里,我必须创建表以输入这些服务.


services_name id

自行车保险-1
信用卡详细信息-2
电话费-3

然后

id services_details

1个company_name
1辆车_没有
1量
1 amount_given_date
1个last_date_to_pay


在services_details中,客户端将根据services_name的要求动态输入

its basically a service project(i.e. bike insurance,telephone bill,credit card bill) all these bill details and amount will be given to a small company., that company will pay amount to concern things.

here i have to create table for enter these services.

ex
services_name id

bike insurance - 1
credit card details - 2
telephone bill - 3

then

id services_details

1 company_name
1 vehicle_no
1 amount
1 amount_given_date
1 last_date_to_pay


in services_details client will enter dynamically as per services_name requirement

推荐答案


检查此
http://www.youtube.com/watch?v=uL3Rh_pAcNs [ http://mrbool.com/creating-databases-using-sql-server- management-studio-express/4672 [ ^ ]
http://www.databasejournal. com/features/mssql/article.php/3640896/SQL-Server-2005-Management-Studio-Part-2.htm [ http://www.techonthenet.com/sql/tables/create_table.php [ ^ ]
http://www.sqlcourse.com/create.html [ http://sql-info.de/mysql/examples/CREATE-TABLE-examples.html [ ^ ]
最好的问候
M.Mitwalli
Hi ,
check this
http://www.youtube.com/watch?v=uL3Rh_pAcNs[^]
http://mrbool.com/creating-databases-using-sql-server-management-studio-express/4672[^]
http://www.databasejournal.com/features/mssql/article.php/3640896/SQL-Server-2005-Management-Studio-Part-2.htm[^]
http://www.techonthenet.com/sql/tables/create_table.php[^]
http://www.sqlcourse.com/create.html[^]
http://sql-info.de/mysql/examples/CREATE-TABLE-examples.html[^]
Best Regards
M.Mitwalli


我不确定我是否正确理解了您的问题.我假设您想要有关如何为服务项目构造表的想法.
这实际上取决于要求和所需的数据.
根据项目细节的描述,一种方法是
您可以在表格中列出所有服务,例如
I am not sure if i understood your question correctly. I am assuming you want an idea on how to structure your tables for your service project.
It would actually depend on the requirements and what data is required.
Given the description of the project details one approach would be,
You can have a table with the list of all services something like
CREATE TABLE tblServiceList
(
	ServiceID INT CONSTRAINT PK_tblServiceList PRIMARY KEY,
	ServiceName VARCHAR(100)
)



然后,您可以有一个表格,其中包含您要为其付款或向该公司的客户提供其他服务的所有公司的列表.



Then you can have a table that holds a list of all the companies for which you take payments or provide other services to that company''s customers.

CREATE TABLE tblCompanyList
(
	CompanyID INT CONSTRAINT PK_tblCompanyList PRIMARY KEY,
	CompanyName VARCHAR(100)
)




您可能还需要跟踪特定服务的状态(例如,将信用卡付款转发给银行等).因此,您可以使用一个表来列出工作流程中的所有状态.




You may also need to track the status of a particular service (Like is the credit card payment forwarded to the bank etc). So you can have a table that will list all the statuses in your workflow.

CREATE TABLE tblBillStatus
(
	BillStatusID INT CONSTRAINT PK_tblBillStatus PRIMARY KEY,
	StatusDescription VARCHAR(50)
)

--Some sample status that can be in your workflow.
INSERT INTO tblBillStatus
SELECT 100, 'Payment received from Customer' --Your client has received a payment from a customer.
UNION
SELECT 101, 'Payment forwarded to company' --Your client has forwarded the amount paid by customer to the comapny
UNION
SELECT 102, 'Payment confirmed' --Received confirmation from the company that they have received the payment your client forwarded.




将有另一个表格保存请求的服务详细信息.所有的帐单付款或任何其他要求的服务都将存储在这里.




There will be another table to hold the service details requested. Here all the bill payments or any other service requested will be stored.

CREATE TABLE tblServiceDetail
(
	ServiceDetailID INT CONSTRAINT PK_tblServiceDetail PRIMARY KEY,
        CustomerName VARCHAR(100),
	CompanyID INT NOT NULL CONSTRAINT FK_tblServiceDetail_tblCompanyList FOREIGN KEY REFERENCES tblCompanyList(CompanyID),
	ServiceID INT NOT NULL CONSTRAINT FK_tblServiceDetail_tblServiceList FOREIGN KEY REFERENCES tblServiceList(ServiceID),
	BillStatusID INT NOT NULL CONSTRAINT FK_tblServiceDetail_tblBillStatus FOREIGN KEY REFERENCES tblBillStatus(BillStatusID),
	InvoiceNumber VARCHAR(50),
	AccountNumber VARCHAR(50),
	BillAmount DECIMAL(14,2),
	DatePaid DATETIME,
	DueDate DATETIME,
	DatePaidToCompany DATETIME
)



这只是一个示例方法.根据要求,您的表中可能会有更多列(例如:您可能要在公司表中存储公司地址和联系信息).此外,根据客户要求,您的表可能必须采用不同的结构.
希望这有助于您了解如何设计表格.

祝你好运:)



This is just a sample approach. Your tables may have more columns based on the requirement (Example: You may want to store the company address and contact information in you company table). Also your tables may have to be structured differently depending on the client requirement.
Hope this helps you in getting an idea of how to design your tables.

Good luck :)


然后呢?您需要尝试并分享您所做的事情并陷入困境.仅发布问题/要求将无济于事.

这是询问者的期望:
1. 先尝试您要做什么!您可能会发现它并不难.
2.制定看起来像问题/无法解决的问题.

试试看,告诉他们是否遇到问题.
成员将很乐意为您提供帮助.


现在,创建3个表:
表1:MstServices-SID,名称
表2:TrnConsumer-CID,名称,数字,金额,AmountDate,LastDay
表3:TrnConsumerPay-TID,SID,CID
And? You need to try out and share what you did and got stuck. Posting just the question/requirement is not going to help.

Here is what is expected of enquirers:
1. TRY first what you want to do! You may find that it''s not that hard.
2. Formulate what was done by you that looks like an issue/not working.

Try them and tell if you face issues.
Members will be more than happy to help like this.


For now, create 3 tables:
TABLE1: MstServices - SID, Name
TABLE2: TrnConsumer - CID, Name, Number, Amount, AmountDate, LastDay
TABLE3: TrnConsumerPay - TID, SID, CID


这篇关于如何在MS-SQL Server 2005中创建表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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