Database Design Where Some Products Are T-shirts With Different Sizes
Feb 27, 2007
Hello,
I'm wondering what would be the best approach to designing a database that will have different products one of them being T-Shirts of different sizes... for example 1 t-shirt design might only have 2 available sizes while another may have 4. I'm kinda stumped on how to approach this cuz there is multiple products like CD's, DVD's, Magazines etc which is pretty straight forward, but the T-shirts have this "variable" to it.
What i'm really wondering is should i have 1 main "Products" Table or should i have a separate table for the t-shirts?
Should there be a column for each available size?
Currently my database has a "products table" that has foreign keys to "Product Type", "Artists", "Genre"
The database is basically for a record company
If anyone has designed a database similar to this i'd love any insight or even possibly to see a database diagram
Thanks
View 1 Replies
ADVERTISEMENT
Nov 4, 2003
Are there any other products out there to monitor database availability
in SQL server 2000 beside Tivoli by IBM?
Thanks;
Lava
View 1 Replies
View Related
Dec 16, 1999
I have inherited a number of databases which were substantially over sized when they were set up. I'd like to reduce both the log and database files to be smaller than their original sizes, what's the easiest way to do this? If anyone has any experience of doing this please reply.
View 1 Replies
View Related
Oct 14, 2006
I've got a 9gig DB which when backed up using the gui comes to 5gigs.When backed using the SQL "backup database" command it comes to 20gigs.Can someone suggest a good reason for the difference?
View 2 Replies
View Related
May 28, 2009
find out the list of databases that have ''ldf'' size greater than ''mdf' using stored procedure?
View 7 Replies
View Related
Jul 20, 2005
Does anyone has a script which gives all databases names and thereallocated, used sizes in SQLserver2k. I want to schedule this to create adaily report.Thanks,Nasir
View 1 Replies
View Related
Jun 5, 2014
I'm trying to capture the sizes of all Databases into a Permanent Table and include the Date.
It works when inserting into a #Temp Table.
When I try inserting into a permanent table it returns NULL.
The following code needs modified to create a permanent table and store the Date:
CREATE TABLE #databases ( DATABASE_NAME VARCHAR(50), DATABASE_SIZE FLOAT, Date VARCHAR(100) )
INSERT #Databases EXEC ('EXEC sp_databases');
SELECT@@SERVERNAME AS SERVER_NAME, DATABASE_NAME,
DATABASE_SIZE AS 'KB',
ROUND(DATABASE_SIZE / 1024, 2) AS 'MB',
ROUND((DATABASE_SIZE / 1024) / 1024, 2) AS 'GB',
CONVERT(date, getdate()) AS Date FROM #databases
DROP TABLE #databases;
View 9 Replies
View Related
Aug 4, 2015
The below query works perfectly fine, except that it produces many outputs instead of one continuous table that can be easaly converted to xml / csv by copying it from the "Results" window.
What I need is a query that will produce a single result for all the tables in all the databases on the server.
The results:
The query:
DECLARE @begin INT = 1, @end INT, @sql NVARCHAR(MAX)
DECLARE @CREATE_TEMPLATE VARCHAR(MAX);
DECLARE @DBNAME VARCHAR(255);
DECLARE @SQL_SCRIPT VARCHAR(MAX);
SELECT @end = COUNT(name) FROM sys.databases
SET @CREATE_TEMPLATE = '
[Code] ....
View 11 Replies
View Related
Apr 22, 2008
Morning forum,
I'm having a problem to which I'm sure the answer is simple...
All I want is a list of databases on my server with their allocated size and the free space within. Something similar to the first table that sp_spaceused gives you but on a server wide scale.
As I say, I'm sure there's a simple solution out there, but alas Google has failed me.
Thanks in advance,
Dan.
View 4 Replies
View Related
May 13, 2015
I have a scenario like below
Product1
Product2 Product3
Product4 Product5
Product1 1
1 0 0
1
Product2 1
1 0 0
1
Product3 0
0 1 1
0
Product4 0
0 1 1
0
Product5 1
1 0 0
1
How to design tables in SQL Server for the above.
View 2 Replies
View Related
Feb 13, 2002
Ok, I'm doing a football database for fixtures and stuff. The problem I am having is that in a fixture, there is both a home, and an away team. The tables as a result are something like this:
-------
Fixture
-------
fix_id
fix_date
fix_played
----
Team
----
tem_id
tem_name
-----------
TeamFixture
-----------
fix_id
tem_id
homeorawayteam
goals
It's not exactly like that, but you get the point. The question is, can I do a fixture query which results in one record per fixture, showing both teams details. The first in a hometeam field and the second in an away team field.
Fixture contains the details about the fixture like date and fixture id and has it been played
Team contains team info like team id, name, associated graphic
TeamFixture is the table which links the fixture to it's home and away team.
TeamFixture exists to prevent a many to many type relationship.
Make sense? Sorry if this turns out to be really easy, just can't get my head around it at the mo!
View 2 Replies
View Related
Mar 9, 2006
Hi,
Does anyone has query to give all table sizes on a database?
Appreciate your help.
Thanks
View 2 Replies
View Related
Oct 29, 2015
I actually work in an organisation and we have to find a solution about the data consistancy in the database. our partners use to send details to the organisation and inserted directly in the database, so we want to create a new database as a buffer database to insert informations from the partners then make an update to the main database. is there a better solution instead of that?
View 6 Replies
View Related
Feb 24, 2006
Hello everyone,I have a webcontrol that uses database-structures alot, it uses the system tables in SQL to read column information from tables. To ease the load of the SQL server I have a property that stores this information in a cache and everything works fine.I am doing some research to find if there are anyway to get information from the SQL server that the structure from a table has changed.I want to know if a column or table has changed any values, like datatype, name, properties, etc.Any suggestions out there ?!
View 3 Replies
View Related
Jul 23, 2005
I have a system that basically stores a database within a database (I'msure lots have you have done this before in some form or another).At the end of the day, I'm storing the actual data generically in acolumn of type nvarchar(4000), but I want to add support for unlimitedtext. I want to do this in a smart fashion. Right now I am leaningtowards putting 2 nullable Value fields:ValueLong ntext nullableValueShort nvarchar(4000) nullableand dynamically storing the info in one or the other depending on thesize. ASP.NET does this exact very thing in it's Session State model;look at the ASPStateTempSessions table. This table has both aSessionItemShort of type varbinary (7000) and a SessionItemLong of typeImage.My question is, is it better to user varbinary (7000) and Image? I'mthinking maybe I should go down this path, simply because ASP.NET does,but I don't really know why. Does anyone know what would be the benifitof using varbinary and Image datatypes? If it's just to allow saving ofbinary data, then I don't really need that right now (and I don't thinkASP.NET does either). Are there any other reasons?thanks,dave
View 7 Replies
View Related
Aug 16, 2007
Hi All,Can u please suggest me some books for relational database design ordatabase modelling(Knowledgeable yet simple) i.e. from which we couldlearn database relationships(one to many,many to oneetc.....),building ER diagrams,proper usage of ER diagrams in ourdatabase(Primary key foreign key relations),designing smallmodules,relating tables and everything that relates about databasedesign....Coz I think database design is the crucial part of databaseand we must know the design part very first before starting up withdatabases.....Thanks and very grateful to all of you....Vikas
View 3 Replies
View Related
Aug 4, 2007
hello,
i have a Products table, and i want to make an image data type to one of his rows (Picture1 for example), i want to know, what is best, to store the picture in the database or store only the direction to the picture?
if i store only the direction, i should take it from some output parameters of the Upload function of ASP and the add it to the Database? can i add it to a special folder for example MySiteUserName + file name?
and another thing: let's say i have Promotion - tinyint, to store the promotion value of this product..If i show products using DataList, i could order my products first after Promotion and then after date added? could i use a special CssClass(font weight or other background) for the products witch has the Promotion more than 10 for example?
how can i know the exact date time (yy/mm/dd/hh/mm) ? - it is taked from the Server date?
thank you
View 3 Replies
View Related
Jan 11, 1999
For the last 2 years we have been using ArcServe for Windows NT (version 6.0 and 6.5) with the Backup Agent for SQL Server. We are now re-evaluating our backup software. Our primary issues with ArcServe are that it has been unstable, unreliable and it does not support the full SQL Server recovery functionality. ArcServe does not include the ability to do point-in-time database recovery. Nor does it support single table restores (when a full database backup was performed). These last 2 items are critical and necessary features at my installation.
What products do people recommend for performs Windows NT files and MS-SQL Server backups?
View 2 Replies
View Related
Feb 25, 2005
Consider the below tables
Table: Products
----------------------------------------------------
| pid | pname | ranking | cat1 | cat2 | cat3 | mid |
----------------------------------------------------
| 1 | x1 | 20 | 2 | 3 | -1 | 1 |
| 2 | x2 | 40 | 3 | 2 | -1 | 1 |
| 3 | x3 | 80 | 2 | 4 | -1 | 1 |
| 4 | y1 | 40 | 2 | -1 | -1 | 2 |
| 5 | y2 | 60 | 1 | 3 | -1 | 2 |
| 6 | z1 | 50 | 3 | -1 | -1 | 3 |
| 7 | z2 | 70 | 1 | 3 | -1 | 4 |
----------------------------------------------------
Table: Manufacturers
---------------
| mid | mname |
---------------
| 1 | A1 |
| 2 | B2 |
| 3 | C3 |
---------------
Table: Categories
---------------
| cid | cname |
---------------
| 1 | I1 |
| 2 | J2 |
| 3 | K3 |
---------------
Say if I want to get the top 3 products that fall under category "J2" and have them ordered by ranking then I would use the
below query
ELECT DISTINCT TOP 3 mid, pid, pname, prank, mname
FROM Products, Manufacturers, Categories
WHERE Products.mid = Manufacturers.mid AND (cat1=2 OR cat2=2 OR cat3=2)
ORDER BY ranking
Now what if I need the top 3 ranked products that fall under category "J2" and have them ordered by ranking selecting only
one product from each manufacturer. So in order words I want the top ranked product from each manufacturer.
What would that query be?
I am having a really tough time and have already spent quite sometime on it unsuccessfully. I would appreciate any help.
View 8 Replies
View Related
Nov 6, 2007
Hi guys, I am an absolute beginner to SQL Server, so please excuse my
simple questions. What is the difference between:
1) Microsoft SQL Server 2005
and
2) Microsoft SQL Server 2005 Express Edition
and
3) MSDE?
Do both the SQL Server and Express Edition have the same functionality?
Thanks,
Kon
View 1 Replies
View Related
Sep 30, 2007
I want to have visitors to my website get price calculations from my database based on input variables which the visitor enters. I think I need the combination of Access, ASP.NET, and Sql Sever. Is this correct?
View 5 Replies
View Related
May 3, 2007
I am trying to write a bit of code that I can pass a brand name to. If the brand name exists I want to return the brandid to the calling middle tier. If the brand id does not exist I want to insert and then return the new brand id. The code below works unless the brand does not exist. Then it inserts, and I get an application exception. Next time I run the code it continues on until the next time it has to do an insert. So the inserts are working, but getting the value back is resulting in an application excetio.
Middle Tier Function (
private static int GetBrandForProduct(clsProduct o)
{
int brandid = -1;
// If the brand name comes in blank use the first word of the overstock product
o.BrandName = o.BrandName.Trim();
// if we do not have a brand for this product
if (o.BrandName.Length == 0) return -1;
Database db = CommonManager.GetDatabase();
;
try
{
// Get the brand id for this brand name
// If it does not exist we will add it and STILL return a brand id
object obj = db.ExecuteScalar("BrandIDGetOrInsert", o.BrandName);
string catid = obj.ToString(); *** FAILING LINE ***
return Convert.ToInt32(obj.ToString());
}
catch (Exception ex)
{
throw ex;
return -1;
}
return brandid;
}
Stored Procedure: -----------------------------------------------------------------------------------------------------------------------------------------------------------------------
ALTER PROCEDURE [dbo].[BrandIDGetOrInsert]
-- Add the parameters for the stored procedure here
@brandnameparm varchar(50)
AS
BEGIN
-- SET NOCOUNT ON
SELECT brandid from brands
where Lower(brandname) = Lower(@brandnameparm)
-- If we found a record, exit
if @@rowcount > 0 return
-- We did not find a record, so add a new one.
begin
insert into brands (Brandname) values(@brandnameparm)
end
SELECT brandid from brands
where Lower(brandname) = Lower(@brandnameparm)
END
View 5 Replies
View Related
Aug 8, 2007
Hi everyone,
This is probably a very easy question:
I have a shopping cart table and two products tables (legacy reasons...).
I need to create a relationship between the ShoppingCart table and the two products tables such that no products are entered in the Cart which don't exist in either product table 1 or product table 2.
Any ideas?
Thanks heaps,
LJ.
View 1 Replies
View Related
Nov 20, 2005
I have successfully downloaded and installed the VS C# 2005 Express, Web Developer 2005 Express, and SQL Server 2005 Express.
View 1 Replies
View Related
Mar 19, 2007
Hi
I'm trying to select the TOP 20 Products per Catagory out of my Star Topology Database
if someone would PLEASE be able to help me out.
Here is my Query: -
SELECT Distinct (SELECT TOP 20 DP.[Description]), DP.Mims_Sub_Cat, SUM(FD.Cost) AS 'Cost'
FROM DIM_Product DP, FACT_Dispensary FD, DIM_Time DT, DIM_Client DC
WHERE DP.Product_KEY = FD.Product_Key
AND FD.Time_KEY = DT.Time_KEY
AND FD.Client_Key = DC.Client_KEY
AND DT.[Year] = 2007
AND DT.[Month] IN (2)
AND Client_name LIKE '%Medicare%'
AND DP.Manufacture_Name LIKE '%Cipla%'
--AND DP.[Description] IN (SELECT TOP 20 [Description])
AND DP.Mims_Sub_Cat IN (SELECT Mims_Sub_Cat)
GROUP BY DP.Mims_Sub_Cat, DP.[Description], FD.Cost
ORDER by DP.Mims_Sub_Cat, SUM(FD.Cost) DESC
My other problem is that it keeps on selecting the same products although i have a distinct in my query
The query will select a product with the amount and then select the same product again with a different amount.
Example :-
Product Descripion Catagory Cost
ULTAK TABS 150MG 60 Acid Reducers 384.94
ULTAK TABS 150MG 60 Acid Reducers 85.54
ULTAK TABS 150MG 60 Acid Reducers 56.98
View 6 Replies
View Related
Apr 16, 2007
How can I store more than one category in a products table?
For exampe: I have a dvd website where the admin can add new dvd's. On the website all the categories are listed with a checkbox. If the dvd is a action comedy the admin have to check these two checkboxes. But how do I store that in the sql database an retrieve it?
Thanks
David
View 3 Replies
View Related
May 29, 2008
Hi i've to table where i have a product code and a area code.
I want to insert the values from table 1 into table 2 if the product code and area code do not already exists in the table in table 2.
Am using this code below but it does not seem to be working.
select distinct p_code1, area_code
from table1
where not exists
(select p_code, area_code
from table 2 )
View 2 Replies
View Related
Jul 20, 2005
[crossposted]Hi, I wonder if anyone might lend me a brain.I have a stock database to build that covers over 1000 products, whichmight be said to exist in around 50 product families.Obviously, just to be awkward all the types of stock will havedifferent attributes. So one product might be a tube withinside/outside diameter and length and another a T shaped cable joint.All I can come up with is a separate table for each stock type familyand store the table name and product code in the main stock table, so:Tables:ProdAProdBProdCStockStock attributes:ProdIdProdTableAmountDateetc..ProdA attribute:ProdIdAttributeXAttributeYAttributeZetc..Then use code to parse the table and product ID to select the correctquery to get the product details. BUT This seems awefuly inelegant andpotentially wrong so I'm loathe to continue down this route.Can anyone tell me the "right" way to do this, I feel sure it must bea classic db design exercise, but unfortunatly one they didn't teachus at University -- or maybe I was asleep...Thanks!
View 4 Replies
View Related
Oct 23, 2015
I got a stored proc which returns the result dataset.
My requirement is to sort the final output depending on a parameter value (which is dependent on 2 different amount column from the result dataset) , display only top 10 products and equate the % mix for those 10 products only. Basically the % mix column should sum up to 100% for those top 10 products.
How do I achieve it in SSRS ?
If I do
=Fields!ProductCurrentBalance.Value/SUM(Fields!ProductCurrentBalance.Value, "ds_Top10ProductMix")
Then it divides by the SUM for all products and not the TOP 10 products only.
View 5 Replies
View Related
Sep 11, 2007
The query I have written below works fine. However, I now want to uncomment the WHERE clause below to find entries where the PatientAge does not fall between the PAGBeginningAge and PAGEndingAge. However, when I uncomment the WHERE clause line I receive the following error message:
Msg 156, Level 15, State 1, Line 28
Incorrect syntax near the keyword 'FROM'.
SELECT ampfm.rpt_AdtVisit.PatientFullName, ampfm.rpt_AdtVisit.AdmitPriorityCode, ampfm.dct_AdmitPriorityType.AdmitPriorityTypeName,
ampfm.rpt_AdtVisit.AccountNumber, ampfm.rpt_PatientDemographics.PatientAge, ampfm.rpt_PatientDemographics.PatientAgeGroup,
ampfm.rpt_PatientDemographics.PatientSex,
CASE WHEN PatientAgeGroup = '0 - 14' THEN '0' ELSE
CASE WHEN PatientAgeGroup = '15 - 24' THEN '15' ELSE
CASE WHEN PatientAgeGroup = '25 - 34' THEN '25' ELSE
CASE WHEN PatientAgeGroup = '35 - 44' THEN '35' ELSE
CASE WHEN PatientAgeGroup = '45 - 54' THEN '45' ELSE
CASE WHEN PatientAgeGroup = '55 - 64' THEN '55' ELSE
CASE WHEN PatientAgeGroup = '65 - 74' THEN '65' ELSE
CASE WHEN PatientAgeGroup = '75 - 79' THEN '75' ELSE
CASE WHEN PatientAgeGroup = '80 - OVER' THEN '80'
END END END END END END END END END AS PAGBeginningAge,
CASE WHEN PatientAgeGroup = '0 - 14' THEN '14' ELSE
CASE WHEN PatientAgeGroup = '15 - 24' THEN '24' ELSE
CASE WHEN PatientAgeGroup = '25 - 34' THEN '34' ELSE
CASE WHEN PatientAgeGroup = '35 - 44' THEN '44' ELSE
CASE WHEN PatientAgeGroup = '45 - 54' THEN '54' ELSE
CASE WHEN PatientAgeGroup = '55 - 64' THEN '64' ELSE
CASE WHEN PatientAgeGroup = '65 - 74' THEN '74' ELSE
CASE WHEN PatientAgeGroup = '75 - 79' THEN '79' ELSE
CASE WHEN PatientAgeGroup = '80 - OVER' THEN '200'
END END END END END END END END END AS PAGEndingAge
--WHERE PatientAge NOT BETWEEN PAGBeginningAge AND PAGEndingAge
FROM ampfm.dct_AdmitPriorityType INNER JOIN
ampfm.rpt_AdtVisit ON ampfm.dct_AdmitPriorityType.AdmitPriorityTypeCode = ampfm.rpt_AdtVisit.AdmitPriorityCode INNER JOIN
ampfm.rpt_PatientDemographics ON ampfm.rpt_AdtVisit.RegNum = ampfm.rpt_PatientDemographics.RegNum
View 4 Replies
View Related
Sep 11, 2015
i designed a database for eshop.
i have two table one of them is products and it has id,code,name columns and the other one is option with id,proid,option,optiondes column. and there is a relationship with id from products to proid in option table.
i want to make query that results is compare two or more products with the same option column.
View 2 Replies
View Related
Sep 27, 2007
Hi All,
I am designing database where few of the master tables will reside in different database or in case different server. Scenario is
Server "A" with Database "A" may host the "Accounts" table.
Server "B" with Database "B" may host the "Product" table.
I am designing database "Project" which will hosted in Server "A".
My application requires this master tables [readonly access] as data inserted in my application refers this tables. Also there are reports to be generated which refer this tables.
How do i design my database and sql queries?
I am thinking of approach of having equivalent tables created in my database and writing service which keep tables in my database in sync. This will ensure good perfomance during transaction and reports as they will need to refer this table locally as opposed to different database or different server.
Any thoughts on above approach?? or any better/standard way for such scenarios ?
Thanks in Advance. Your inputs will be of great help.
View 14 Replies
View Related
Apr 12, 2007
Hello:
My client has a db with the following structure:
Online US Searchable Map of the 50 US States. Users search criteria is the following: Query records by selecting state, county, then record. Each County table has 10-20 tables. All databases combined = 500MB and TLogs = 100MB.
How would you re-design a relational DB where users could query data by state-county-record. Currenty the DB's are created by the County of each state which creates hundreds of DB's in SQLServer with no realtionship to each US state. What would be the best design to ensure good performance, data integrity and maintenance? Would you create 1 DB with all 50 states, create 4 DB's and divide by region(N,S,E,W), 50 DB's of each state or leave it as is with each county it's on DB? Any suggestions would be appreciated.
thx
rob
View 7 Replies
View Related