Is there a datatype that allows me to store more than one item at a time

Hello Everyone,
Is there a datatype that allows me to store more than one item at a time , in a column in a row?
I have to prepare a monthly account purchase system. Basically in this system a customer purchases items in an entire month as and when required on credit and then pays at the end of the month to clear the dues. So, i need to search the item from the inventory and then add it to the customer. So that when i want to see all the items purchased by a customer in the current month i get to see them. Later i calculate the bill and then ask him to pay and flushout old items which customer has purchased.
I am having great difficulty in preparing the database.
Please can anyone guide me! i have to finish this project in a weeks time.
Item Database:
SQL> desc items;
Name Null? Type
ITEMID VARCHAR2(10)
ITEMCODE VARCHAR2(10)
ITEMPRICE NUMBER(10)
ITEMQUAN NUMBER(10)
Customer Database:
SQL> desc customerdb;
Name Null? Type
CUSTID VARCHAR2(10)
CUSTFNAME VARCHAR2(20)
CUSTLNAME VARCHAR2(20)
CUSTMOBNO NUMBER(10)
CUSTADD VARCHAR2(20)
I need to store for every customer the items he has purchased in a month. But if i add a items purchased by a customer to the customer table entries look this.
SQL> select * from customerdb;
CUSTID CUSTFNAME CUSTLNAME CUSTMOBNO CUSTADD ITEM ITEMPRICE ITEMQUANTITY
123 abc xyz 9988556677 a1/8,hill dales soap 10 1
123 abc xyz 9988556677 " toothbrush 18 1
I can create a itempurchase table similar to above table without columns custfname,csutlnamecustmobno,custadd
ItemPurchaseTable :
CUSTID ITEM ITEMPRICE ITEMQUANTITY
123 soap 10 1
123 toothbrush 18 1
ill just have it as follows. But still the CUSTID FK from CustomerDB repeats for every row. I dont know how to solve this issue. Please can anyone help me.
I need to map 1 customer to the many items he has purchased in a month.
Edited by: Yukta Lolap on Oct 8, 2012 10:58 PM
Edited by: Yukta Lolap on Oct 8, 2012 11:00 PM

You must seriously read and learn about Normalization of tables; It improves your database design (at times may increase or decrease performance, subjective cases) and eases the Understanding efforts for a new person.
See the below tables and compare to the tables you have created
create table customers
  customer_id       number      primary key,
  fname             varchar2(50)  not null,
  mname             varchar2(50),
  lname             varchar2(50)  not null,
  join_date         date          default sysdate not null,
  is_active         char(1)     default 'N',
  constraint chk_active check (is_active in ('Y', 'N')) enable
create table customer_address
  address_id        number      primary key,
  customer_id       number      not null,
  line_1            varchar2(100)   not null,
  line_2            varchar2(100),
  line_3            varchar2(100),
  city              varchar2(100)   not null,
  state             varchar2(100)   not null,
  zip_code          number          not null,
  is_active         char(1)         default 'N' not null,
  constraint chk_add_active check (is_active in ('Y', 'N')),
  constraint fk_cust_id foreign key (customer_id) references customers(customer_id)
create table customer_contact
  contact_id        number      primary key,
  address_id        number      not null,
  area_code         number,
  landline          number,
  mobile            number,
  is_active         char(1)   default 'N' not null,
  constraint chk_cont_active check (is_active in ('Y', 'N'))
  constraint fk_add_id foreign key (address_id) references customer_address(address_id)
create table inventory
  inventory_id          number        primary key,
  item_code             varchar2(25)    not null,
  item_name             varchar2(100)   not null,
  item_price            number(8, 2)    default 0,
  item_quantity         number          default 0,
  constraint chk_item_quant check (item_quantity >= 0)
);You may have to improvise and adapt these tables according to your data and design to add or remove Columns/Constraints/Foreign Keys etc. I created them according to my understanding.
--Edit:- Added Purchases table and sample data;
create table purchases
  purchase_id           number        primary key,
  purchase_lot          number        unique key  not null,     --> Unique Key to map all the Purchases, at a time, for a customer
  customer_id           number        not null,
  item_code             number        not null,
  item_price            number(8,2)   not null,
  item_quantity         number        not null,
  discount              number(3,1)   default 0,
  purchase_date         date          default sysdate   not null,
  payment_mode          varchar2(20),
  constraint fk_cust_id foreign key (customer_id) references customers(customer_id)
insert into purchases values (1, 1001, 1, 'AZ123', 653, 10, 0, sysdate, 'Cash');
insert into purchases values (2, 1001, 1, 'AZ124', 225.5, 15, 2, sysdate, 'Cash');
insert into purchases values (3, 1001, 1, 'AZ125', 90, 20, 3.5, sysdate, 'Cash');
insert into purchases values (4, 1002, 2, 'AZ126', 111, 10, 0, sysdate, 'Cash');
insert into purchases values (5, 1002, 2, 'AZ127', 100, 10, 0, sysdate, 'Cash');
insert into purchases values (6, 1003, 1, 'AZ123', 101.25, 2, 0, sysdate, 'Cash');
insert into purchases values (7, 1003, 1, 'AZ121', 1000, 1, 0, sysdate, 'Cash');Edited by: Purvesh K on Oct 9, 2012 12:22 PM (Added Price Column and modified sample data.)

Similar Messages

  • HT1040 Is there a way to place an order with more than one item at a time? For example I am going to make a few books and have them all shipped to me.  Do I have to order and pay shipping for each one individually?

    Is there a way to place an order with more than one item at a time?  for example I am making a few books and having them all shipped to me.  Do I have to order each one separately and pay shipping each time?

    You have to order each book separately, if the books are different. Only multiple copies of the same book can be ordered in the same order, see here
    Regards
    Léonie

  • Does anyone know of an app that is for invoicing that can be accessed from more than one iPad at a time?

    I have a roofing business with my husband and we both have iPads we need a invoicing program app that we both can use and see the same material on both iPads is there any apps that anyone knows of that can do this?

    You'll need a program that can open and edit the invoices. You can search the app store for "invoices" and see what you can find - perhaps there is a cloud-based one that would allow you to store the invoices on their server.
    Or if the apps are fairly simple, you could open them in a Word Processing app that does sync two ways with the cloud and do your work on them - and then store the receipts in Dropbox/iDisk/Sugarsync. Loading the actual documents onto those services is very easy and self-explanatory once you sign up for them.

  • How do I reopen or reset the option that allows me to view more than one open email account at a time?

    In the past, I could open one email address, then jump to another email address, while not having to log in and out? I must have changes something? Once logged in to one email address, the other email addresses would rise up in the lower right corner to notify me I received a new email?
    How do I turn that back on?

    In Firefox all browser windows and tabs use the same cookies that will identify you to the server.
    You can look this extension if you want to sign on with different identities at the same time:
    * Multifox: http://br.mozdev.org/multifox/

  • My old version of PhotoShop allowed me to open more than one picture at a time.  I want to create a poster using several pictures.  I used to be able to paste one onto another.  PhotoShop Elements 12 is driving me crazy because I cannot figure out how to

    Help me.

    Hi Suzkas,
    I was new to mac a short time ago and I had frustrations in the learning curve especially as I was so used to working with PC.
    If you look at the top left of the screen you will see the words SAFARI next to the apple logo. if not then either open safari or click on the window and the mac will then show safari at the top. If you now click on FILE you can select NEW WINDOW or NEW TAB as you wish. I often use new tab and switch between them. If you go to VIEW and select CUSTOMISE TOOLBAR you can drag an icon to the top of the safari window and you won't have to keep going to the menu to add a new tab. I will sometimes select new window to keep something separate from my other work.
    If you close down a window you will often lose your place, but using the tab system you will leave the window active unless you select the cross to terminate. If you have a separate window open you can select the orange blob (between the red and green at the top) and the window will slide down to the dock and stay there, active, for you to return and continue.
    Hope this help, stay with it, go see the instore staff and pretty soon you wont look back
    PS I have PARALLELLS6 running with a copy of windows 7 on my mac. This means that I can switch to microsoft if I want to. However, with office for mac installed I rarely need to now, the only time I ever open windows is for an application that has no mac version.

  • Is there a way to lock transparent pixels for more than one layer at a time?

    I've tried selecting multiple layers to modify but the lock transparent pixels box becomes greyed out once I've selected more than one layer. Apologies in advance if this is deemed to be a stupid question but it would be greatly appreciated if someone knows of a solution. It would be very handy for some of the projects I'm currently developing.
    Thanks.

    I have not had a problem in Photoshop CC 2014 as long as I selected a layer with transparency, in my case the gray checkerboard. The button would dim if I selected an adjustment layer.

  • Is there a stereo bluetooth headset that can pair with more than one device at a time?

    Is there a stereo bluetooth headset that can pair, i.e. multipoint, with more than one device at a time?
    Are the MacBook and iPhone 4 capable of multipoint bluetooth technoloagy?
    The goal is for my wife to be able to watch her Korean TV soap operas on her MacBook and still receive a call on her iPhone 4 via a stereo bluetooth headset.
    I was looking at the Motorola S10-HD but after further review saw that it only pairs with one device at a time.
    Appreciate any and all input. My Googling has returned no results.
    Rick

    TeslasBB wrote:
    pairing my BB8330 with my blue tooth earphone(TM:jawbone) and my microsoft sync thats in my car simultaneously? if i pair with the car, will i have to pair my jawbone all over again?
    You can only pair one device at a time to your 8330, or any other phone for that matter.  The "pairings" are saved to the phone, you can use one or the other and you won't have to pair it again.  Once you turn your bluetooth device on and the phone is on, they will find each other again.
    Hope this helps,
    John
    Stevie Ray! 1954-1990
    ** Don't forget to resolve your post with the accepted solution.

  • Hi All, I have two questions. First of all my CS3 is saying that it is installed on more than one machine, is there a way of seeing what machines my serial number is registered to? If i want to buy another CS3 serial number how do i go about it? I cannot

    Hi All, I have two questions. First of all my CS3 is saying that it is installed on more than one machine, is there a way of seeing what machines my serial number is registered to? If i want to buy another CS3 serial number how do i go about it? I cannot afford to move to the creative cloud.....

    there's no way for you to identify which machines have or had cs3 activated, and you can no longer purchase a cs3 license from adobe.
    you can request an activation count reset (Contact Customer Care) and deactivate your cs3 on all your computers.  you can then install and activate on up to two computers.

  • Light Switch 2011 "C#" How to allow filter which take more than one entry to take * and show all other entries?

    Dear All,
    I have created the following code which extended my filter functionality and allowed a to take more than one entry (Comma have to be inserted after
    each entry). 
    For example:
    "Country Filter" can take ----> Germany,Egypt,Holand<o:p></o:p>
    "City Filter " can take ---------> Berlin,Münster
    if (Country_PAR != null)
    String[] Country_Array = Country_PAR.Split(new Char[] { ','});
    query = from p in query where Country_Array.Contains(p.Hotel_Country) select p;
    if (City_PAR != null)
    String[] City_Array = City_PAR.Split(new Char[] {','});
    query = from p in query where City_Array.Contains(p.Hotel_City) select p;
    Now want to extend it more and say something like:
    If  * is included ---- > Give me all entries        
         ex. Ge*     This will give me everything which starts with Ge
    If <> is entred -----> Give me entries which are not equal to a certain entry
         ex. Country Filter = <> Germany          give me all other entries except Germany
    Thanks alot,
    Zayed

    Thanks your reply. I mean no one know my feeling. except if the new car is your. If Geek Squad can't install it. Just let me know and go. right? I ask many time? Are you ok to finish? He said yes. First time fail after 5 hours long wait and tow my car to Toyota repair. Second time said only take 20 to 30 minutes to program the key. but fail again after about 4 hours 30 minutes long wait and head light is not automatic turn on at night. I have to take a day off drive to Toyota repair. My time is money. wait there more than 10 hours and done nothing. 5 days no car and take the subway Bus and long walk. How do I feel? I m the customer. if without the customer. How you get pay? Geek Squad use my remote start and alarm and I can't return it. I loss time and money. My new car has a repair record. That is what Bestbuy want to do for the customer. Geek Squad work for Bestbuy. right? You are not just loss one customer. You will loss more and more than the remote start alarm cost. Bestbuy will not know? How come just 200$ remote start alarm and the 50$ module. Bestbuy don't want to reimburse. I m not tell you to pay me 5 days for rental car. why don't just want a happy ending? Bestbuy is big company. I m very small. 250$ it cost Bestbuy nothing. You can't let the customer loss money because you. right?

  • I'm using an iPhone 4. I used to be able to send more than one picture at a time to another iPhone. Now I get messages that it cannot be delivered.  What's going on?

    While on vacation in Canada in July I started having trouble sending more than one pix at a time to other users. I don't recall having this problem before. Is there a limit on the number of pictures you can send via text? I wonder if I messed up some settings while I was in Canada. I had things set so that I could not receive phone calls so I wouldn't get charged.  Could I have messed up text / multimedia settings as well?

        We want your phone working just as well now as it did before your trip, sngbrd9. Are you trying to send the pictures to other Apple users using iMessage or are they being sent through MMS/picture messaging? Are you able to send pictures one at a time to those same contacts without an error? Did you change any settings in your camera to have HDR now instead of a slightly lower resolution with a smaller file size? 
    JenniferH_VZW
    Follow us on Twitter www.twitter.com/vzwsupport

  • HT5731 Is there a new trick to buying more than one song at a time?

    In the past I've bought more than one song at a time, its nit working though. Is there a new trick?

    If by "in the cloud" you mean iTunes purchased tracks, deleting them from the device will not impact that. You will be able to redownload them later. To clear all tracks from the Music app: Settings app > General > Usage > Manage Storage [under STORAGE] > Music > All songs [swipe to the left] > Delete

  • Why won't my Time Capsule allow me to connect more than one device to the network at a time?

    Ok here is the shortest story I can come up with...
    Several months ago lightening struck my house and ruined the power cord for my old AIR PORT EXTREME....after replacing the power cable my wireless network began to prohibit more than one device at a time to connect to the wireless network.
    I replaced that network with a new TIME CAPSULE and it is doing the same thing.  I took my old AirPort Extreme to my work and it works like a charm.  My ISP says it is an Apple problem but I have had the same settings both at home and at work.  Work is great, multiple devices connect but home is one at a time and in order to connect ANOTHER device I have to power down one, and reboot the router and fire up the device I wish to connect.
    Any suggestions?

    I am running off a Fiber line....the unit that is a battery back up and appears to be a modem as well is called CyberPower CS24U12V-NA3
    Techincally, there is no "router" in my house, there is a LOCKED control box outside, a battery back up module in the garage that shows battery life and connection, then a cat5 outlet in my laundry room..All of which was installed by my ISP.
    I am using a 2TB Time Capsule running DHCP in Bridge Mode.  I can't find the software version but updated it while installing it within the last two months.
    Under Network Tab
    Enable NAT Port mapping is checked
    Under the Wireless Tab
    we have a 5ghz Network
    Radio mode is set to:  802.11a/n-802.11b/g/n (Automatic)
    2.4 GHz is Auto
    5 Ghz is Auto
    I hope this helps....

  • Script to find users that are a member of more than one of a list of specific groups

    Hi,
    I need to generate a list of users that are members in more than one group, out of a list of specific security groups.  Here's the situation:
    1) We have about 1100 users, all nested under a specific OU called CompanyUsers.  There are sub-OUs under CompanyUsers that users may actually be in.
    2) We have about 75 groups, all directly under a specific OU called AppGroups.  These groups correspond to a user's role within an internal line of business application.  All these groups start with a specific character prefix "xyz", so the group
    name is actually "xyz-approle".
    I want to write a script that tells me if a user from point 1) is a member in more than one group in point 2).  So far, I've come up with a way to enumerate the users to an array:
    $userlist = get-qaduser -searchroot 'dq.ad/dqusers/doral/remote' | select samaccountname |Format-Table -HideTableHeaders
    I also have a way to enumerate all the groups that start with xyz that the user is a member of:
    get-QADMemberOf -identity <username> -name xyz* -Indirect
    I figure I can use the first code line to start a foreach loop that uses the 2nd code line, outputting to CSV format for easy to see manual verification.  But I'm having two problems:
    1) How to get the output to a CSV file in the format <username>,groupa,groupb,etc.
    2) Is there any easier way to do this, say just outputting the users in more than one group?
    Any help/ideas are welcome.
    Thanks in advance!
    John

    Here is a PowerShell script solution. I can't think of way to make this more efficient. You could search for all groups in the specfied OU that start with "xyz", then filter on all users that are members of at least one of these groups. However, I suspect
    that most (if not all) users in the OU are members of at least one such group, and there is no way to filter on users that are members of more than one. This solution returns all users and their direct group memberships, then checks each membership to
    see if it meets the conditions. It outputs the DN of any user that is a member of more than one specfied group:
    # Search CompanyUsers OU.
    strUsersOU = "ou=CompanyUsers,ou=West,dc=MyDomain,dc=com"
    $UsersOU = New-Object System.DirectoryServices.DirectoryEntry $strUsersOU
    # Use the DirectorySearcher class.
    $Searcher = New-Object System.DirectoryServices.DirectorySearcher
    $Searcher.SearchRoot = $UsersOU
    $Searcher.PageSize = 200
    $Searcher.SearchScope = "subtree"
    $Searcher.PropertiesToLoad.Add("distinguishedName") > $Null
    $Searcher.PropertiesToLoad.Add("memberOf") > $Null
    # Filter on all users in the base.
    $Searcher.Filter = "(&(objectCategory=person)(objectClass=user))"
    $Results = $Searcher.FindAll()
    # Enumerate users.
    "Users that are members of more than one specified group:"
    ForEach ($User In $Results)
        $UserDN = $User.properties.Item("distinguishedName")
        $Groups = $User.properties.Item("memberOf")
        # Consider users that are members of at least 2 groups.
        If ($Groups.Count -gt 1)
            # Count number of group memberships.
            $Count = 0
            ForEach ($Group In $Groups)
                # Check if group Common Name starts with the string "xyz".
                If ($Group.StartsWith("cn=xyz"))
                    # Make sure group is in specified OU.
                    If ($Group.Contains(",ou=AppsGroup,"))
                        $Count = $Count +1
                        If ($Count -gt 1)
                            # Output users that are members of more than one specified group.
                            $DN
                            # Break out of the ForEach loop.
                            Break
    Richard Mueller - MVP Directory Services

  • Allow for more than ONE item in a single row?

    Allow for more than ONE item in a single row? I can't use this wonderful program unless I can get more than one field on a row (i.e. 1st name, mi, last name etc)

    Thanks for your feedback. This is something we definetely want to provide next year (can't say when yet).
    If others are interested in this feature please vote on it within the idea tab: http://forums.adobe.com/ideas/1046
    That helps us prioritize our work based on customer demand.
    Randy

  • App that can send more than one attachment at a time....

    Does anyone know of a app that I can send more than one attachment at a time like resumes + cover letters. Not having any luck with gmail or pages for the Ipad.
    Please help

    The MPEG Streamclip app can batch process videos. It can even convert up to  4 videos at the same time.
    http://www.squared5.com/
    It's free...
    Just drop as many videos as you like into the batch window.

Maybe you are looking for