Click here to Skip to main content
15,902,939 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
Hi,

I wanted to know if we can execute DDL commands at runtime. For eg I want to maintain the record of the tickets booked by a particular customer. I am not getting what should be the structure of tables to be created. If the customer ID is the primary key and we need to store the details of the tickets booked by that ID, how should I so that??

FOR EG :
CUST_ID  ,  CUST_NAME  ,  CUST_ADD


If the Customer books a ticket, it should be added somewhere in the database i.e the Ticket Numbers for each transaction should be saved somewhere. Now the question is, where should we save the tickets. If we create some table with the CUST_ID as the Primary key referring the Customer table, then what should be the structure of the table.i don't think that we can create columns at runtime.
If I have put in this way:-
CUST_ID , TICKET_1, TICKET_2, TICKET_3,TICKET_4

it can save only 4 tickets, and as the tickets will tend to increase in number, it would not be appropriate.

Is it the case that all tables are previously created for all users with something like the table name as the CUST_ID where the data is inserted as and when the customer books a ticket.

I am new in this area, so please provide me some help. Thanks in advance.

Regards
Jashobanta Chakraborty
Posted
Updated 11-Jan-12 1:43am
v2

1 solution

The tikcket must be in the row not in the column:

Table Customer

CUST_ID CUST_NAME CUST_ADD
1 John ???
2 Steve ???


Table Customer_Ticket

CUST_ID TICKET(Transaction)

1 first Ticket
1 Second Ticket
1 And so On..
2 first ticket
2 And so on..
 
Share this answer
 
Comments
vijaynet10 31-Jan-12 5:58am    
ya its having good idea

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900