帮助了解预订系统

发布于 2024-11-04 06:39:40 字数 341 浏览 4 评论 0原文

我正在创建一个剧院预订系统。

我很困惑如何在一次预订中获取多张门票,并能够单独查询这些门票。 (与问题无关的字段未包含在内)

我有一个票表:

ticketId, ticketName

预订表:

bookingId, bookingReference, ticketId

连接此表时,我将能够创建许多票,但 bookingId 每次都会更改,我需要能够找到与预订相关的所有门票,然后查询单独的门票,以便它可以用于单票打印等。

任何人都可以帮助我了解我需要做什么。

谢谢。

I'm creating a theatre booking system.

I am quite confused on how I can get multiple tickets to one booking, and able to query those tickets separately. (fields that are of no relevance to the question have not been included)

I have a ticket table:

ticketId, ticketName

Booking Table:

bookingId, bookingReference, ticketId

When connecting this I will receive the ability to create many tickets but the bookingId will change everytime, I will need the ability to find all the tickets associated with a booking and then query an individual ticket so it can be used for single ticket printing etc.

Can anyone help me understand what I need to do.

Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

孤独患者 2024-11-11 06:39:40

Tickets 和 Bookings 之间的关系是多对一的。在票证表中包含一个字段 bookingid 比在 Booking 表中包含一个 TicketId 字段更有意义:

票证表:

ticketId、ticketName、bookingId

预订表:

bookingId、bookingReference

SELECT * FROM Ticket WHERE bookingid = foo
SELECT * FROM Ticket AS T INNER JOIN Booking AS B on T.bookingid = B.bookingid

The relationship between Tickets and Bookings is many to one. It would make more sense to have a field bookingid in the ticket Table rather than having a ticketId field in Booking table:

Ticket table:

ticketId, ticketName, bookingId

Booking Table:

bookingId, bookingReference

SELECT * FROM Ticket WHERE bookingid = foo
SELECT * FROM Ticket AS T INNER JOIN Booking AS B on T.bookingid = B.bookingid

etc

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文