SQL 2012 :: Normalization Database Tables
Jan 15, 2015
I have decided to use Wufoo online forms so collect evaluation data from my clients. Each form will have different type of data.
For example
Form 1 might have:
Client id, name, user id, comments
Form 2 might have:
Client id, name, user id, address, comments, telephone number
Form 3 might have:
Client id, name, user id, comments, date of birth, email address
Each form can have over 20+ data types which can be all different to other forms.My question is: What is the best way to store all the data into sql server without creating new columns of new data types everytime a new form is created in wufoo.
View 1 Replies
ADVERTISEMENT
Apr 14, 2005
Hi everyone..
Well i have my tables ready to build the database on to the sql server... My probs is normalization of the tables being used in the database....
Is there any best possible way / [short-cut.. very weird to ask this :) ] using the sql server...?
View 6 Replies
View Related
Jan 31, 2006
Hi,I am using MS-SQL server to store my database.My problem is that I have around 150+ database files in DBF format.Each database file consists of fields ranging from 2 to 33 in number.Also, there are some fields which have just one entry and rest areNULL.This database will be accessed by a printing software.Please advice as to how I should proceed to normalize this database.Regards,Shwetabh
View 2 Replies
View Related
Feb 14, 2008
Is it worth it for performance purposes to create additional fields in table so that when a database query is made two tables don't need to be joined?
View 1 Replies
View Related
Dec 8, 2005
Hi all,
This is actually a pretty stupid question, but somehow I need an answer from you experts.
We are currently building a web application using ASP.NET, and it simply manages contact information, like outlook. Contact information include first name, last name, birthday, etc. It also tracks address, phone number, and email. Here come the problem.
We allow only one address, 4 phone numbers and an email for each contact. When we building the database table, should we create 6 fields to contain all the information or should we create address, phone, and email table and then create the relationship between them.
Will the first method speed up the performance? Or the second method is the proper way?
I need some pros and cons on each
Thanks so much for your opinion
Sam
View 5 Replies
View Related
Sep 29, 2006
Hi,
I'm designing a database to represent items in a restaurant menu. An item has the following information associated with it.
Item-
Name, Price, Catagory, Ingredients(many), and Options(many)
Ingredients-
Name, and Price
Catagory-
Name
Options-
Name and Price.
This is how I have it set up so far.
-------------------------------------
Table Item
-ItemID as Primary Key
-Name
-Price
-------------------------------------
Table Ingredients
-IngID as Primary Key
-Name
-ItemID as relationship to Table Item
-------------------------------------
Table Catagory
-CatID as Primary key
-Name
-Item ID as relationship to Table Item
-------------------------------------
Table Options
-OptionID as Primary key
-Name
-ItemID as relationship to Table Item
-Price
I would like to know if i'm normalizing correctly. Much Thanks.
Dan
View 5 Replies
View Related
Jul 23, 2005
Normalization Question - Please bear with me, hopefully things will beclear at the end of the question.Given a treaty table containg treaties; Treaty1, Treaty2 etc and abenefit table; Benefit1, Benefit2 etc. A treaty can only have certainbenefits:-For example Treaty 1 can process Benefit1 and Benefit2.To maintain this relationship a new table TreatyBenefit has beencreated: -Treaty1Benefit1Treaty1Benefit2A further table called policy has been added. A treaty can have manypoliciesTreaty1Policy1Treaty1 Policy2A Policy can contain 1 or more benefitsPolicy1 Benefit1Policy1 Benefit2 etc.Giving structure as follows:-T - TB - B|PGiven the above, should there be a constraint between policy andTreatyBenefit or Policy and Benefit to enforce referential integrity.If so which constraint, if not what form of constraint / checkingshould I be using, to ensure that a Policy will contain the correctbenefits.ThanksAdrian
View 7 Replies
View Related
Mar 13, 2014
below is my statement to get data from one column (VARCHAR) from table SUPPLY_ITEM_01
SELECT
@@SERVERNAME as ServerName,DB_NAME() AS DatabaseName,
SUM(CASE WHEN CHARINDEX (CHAR(013) , supplydetail) > 0 THEN 1 ELSE 0 END) AS TotalCHAR013,
SUM(CASE WHEN CHARINDEX (CHAR(012), supplydetail ) >0 THEN 1 ELSE 0 END)AS TotalCHAR012,
SUM(CASE WHEN CHARINDEX (CHAR(010), supplydetail ) >0 THEN 1 ELSE 0 END) AS TotalCHAR010,
SUM(CASE WHEN CHARINDEX (CHAR(009),supplydetail ) >0 THEN 1 ELSE 0 END) AS TotalCHAR009
FROM
[code]...
I need to get result from all the tables and all the columns which has bad data including schemaName, table name and column name in result.
View 9 Replies
View Related
Apr 14, 2015
We need to replicate data from a live database to a reporting database nightly.
There is data which is only needed for the reporting function - namely the selection criteria for reports which are to be run nightly or monthly.
Is it possible to have extra tables in the target database, holding the selection criteria?
If not, we'll have the reports running heterogeneous queries between the target database and a separate database with the selection criteria in it.
View 1 Replies
View Related
Aug 7, 2014
How can I add the option to import data from Visual FoxPro tables into SQL 2012 database?
View 0 Replies
View Related
Aug 21, 2014
When I create a table in sql server database name appears in prefix of table.
My database name: Digitall
My table name: Digitall.News
How can I remove Digitall prefix from my tables?
View 1 Replies
View Related
Oct 1, 2014
I am using SQL server 2012. An user tried to export tables from GIS application to the SQL database.
After export, and login to the SQL server, we see all the tables has his name as the schema but not dbo.
He was added as a login and user as in a windows group. Meaning he is a member of the windows group.
I assume when export, the default schema should be dbo. but apparently not.
I went to the setting and explicitly make the default schema for the windows group user to dbo. But he tried again, it still use his username as schema prefix to the tables. just wondering why is this?
View 7 Replies
View Related
Oct 17, 2014
I have this t-sql code which will get some table stats on one database at a time, I was wondering how I would get it to loop through all databases so it will pull the stats from all tables in all databases. Here is my code:
Select object_schema_name(UStat.object_id)
+ '.' + object_name(UStat.object_id) As [Object Name]
,Case
When Sum(User_Updates + User_Seeks + User_Scans + User_Lookups) = 0 Then Null
Else Cast(Sum(User_Seeks + User_Scans + User_Lookups) As Decimal)
/ Cast(Sum(User_Updates
[code]....
View 1 Replies
View Related
Nov 26, 2014
I am trying to clean up security. When I check tables in a specific database I see a list of users with select access. There are 1000+ tables in the database. I know I can do 'revoke select on table_name to user_name' ....
View 3 Replies
View Related
Jan 7, 2015
I need to find all tables which has a join (either inside an sp, view, etc) with my given table in a db.
sys.dm_sql_referencing_entities doesn't work here.
Note: i dont want to identify by FK References, for 2 reasons:
1) tables might not met with a join (just FK was defined)
2) sometimes, a join happened between tables, without an FK defined
View 1 Replies
View Related
Jun 9, 2015
In last week my database was crashed and some how i managed to restore it back on SQL2K12 but after restoration all the relationships are removed and sql server is showing below message when i open diagram of the database.Table(s) were removed from the diagram because privileges were removed to these table(s) or the table(s) were dropped.how to get back all the relationships of the tables.
View 2 Replies
View Related
Nov 5, 2014
Doing a data migration from one CRM to another and need to get a listing of all entities in current CRM, together with fields and field types. OK, I got the XRMToolBox which gives me that, but I'm hoping there is a sql tool out there that will do the same, plus give me a count on each field of the number of entries in that field in the database.
View 0 Replies
View Related
May 19, 2014
i have database which has 25 tables. all tables have productid column. i need to find total records for product id = 20003 from all the tables in database.
View 9 Replies
View Related
Jul 11, 2014
I have a database project where objects have been pulled in from the database using schema compare.
Unfortunately CDC tables which are referenced in stored procedures on the database have not been pulled in by the schema compare & hence I cannot build the project and deploy changes back to the database.
How to get these tables included in the project .
View 1 Replies
View Related
Dec 4, 2014
I found it pretty interesting. I checked the size of a database, before implementing database compression across all the user tables in a database. And Post implementation of compression too I checked the size of the database.
I did not find any difference. But if I expand the table and check propetires->storage and I can see that PAGE compression is implemented across all the tables, but no compaction in the size of the db. It still remains the same.
View 6 Replies
View Related
Jul 17, 2015
CREATE TABLE [Table 1] (
Id varchar,
TableTwoId varchar,
OtherData varchar )
CREATE TABLE [Table 2] (
Id varchar,
MoreData varchar )
What is the link between these two tables?
I have databases that have zero keys defined, no foreign key constraints, no unique value constraints. I cannot assume that an Identity column is the Id. The end game is be able to output that [Table 1].[TableTwoId] = [Table 2].[Id] but cannot assume that all linkage in the database will be as simple as saying "if the field name contains a table name + Id then it is the Id in that table."
Currently have written a script that will cycle through all columns and start identifying keys in singular tables based on the distinctness of the values in each column (i.e. Column1 is 99% distinct so is the unique value). It will also combine columns if the linkage is the combination of one or more columns from Table 1 = the same number of columns in Table 2. This takes a long time, and it somewhat unreliable as IDENTITY columns may seem to relate to one another when they don't.
View 2 Replies
View Related
Nov 21, 2013
i need a query to return the top 10 tables in each database on a server. have used EXEC sp_msforeachtable 'sp_spaceused ''?''' which returns what I need for one db but I need it to loop through and gather the info for all dbs on server. maybe need cursor not sure. for reporting reasons i would like to include the name of the server and name of database.
View 3 Replies
View Related
Oct 7, 2015
I am using the following select statement to get the row count from SQL linked server table.
SELECT Count(*) FROM OPENQUERY (CMSPROD, 'Select * From MHDLIB.MHSERV0P')
MHDLIB is the library name in IBM DB2 database. The above query gives me only the row count of table MHSERV0P. However, I need to get the names, rowcounts, and sizes of all tables that exist in MHDLIB librray. Is it possible at all?
View 1 Replies
View Related
Aug 17, 2004
Hi all,
I am still confuse in normalization. (1st, 2nd, 3rd, and more.)
Any body have a detail idea abt that ???
Pls explain with example.
Thxs.
Regards,
Shailesh Patel
View 2 Replies
View Related
Nov 6, 2000
Is it possible to normalize a database using SQL statement? I have a huge duplicated records on a certain fields and need to do some normalization on it. For example, the raw data below
Field_A Field_B Field_C Field_D Field_E
1 0001 00/05/11 14.00 Start
1 0001 00/05/11 15.00
1 0001 00/05/11 16.00 End
1 0002 00/05/11 16.10 Start
1 0002 00/05/11 17.50
1 0002 00/05/11 17.10 End
should be normalized to
Field_A Field_B Field_C Duration(End-Start)
1 0001 00/05/11 16.00-14.00=2.00
1 0002 00/05/11 17.10-16.10=2.00
How can I do it using a SQL Query?
Andy
View 3 Replies
View Related
Jan 15, 2008
Hi all,
Does anyone know of a good resource or tutorial that teaches you the basics of the 3 normal forms?
Muchos Gracias
View 2 Replies
View Related
Mar 6, 2008
I'm working on a normalization for one of my classes and I've been sick and I feel lost now, could one of you please look at my database statements and tell me if/what is wrong with it?
FIRE_REPORT(FireID,Alarms,Address,FiremanID,FiremanName,FiremanPhone,FiremanHomeStation,StationAddress,StationPhone,TruckID,License,TruckHomeStation)
I came up with..
TruckID->License,TruckHome
FireID->Alarms,Address
FiremanID->FiremanName,FiremanPhone,FiremanHomeStaion,StationAddress,StationPhone
Which lead to...
FIRE(FireID,Alarms,Address)
FIREMAN(FiremanID,FiremanName,FiremanPhone,FiremanHomeStation,StationAddress,StationPhone)
TRUCK(TruckID,License,TruckHome)
Referencial Integriety Statements
FireID in FIRE_Report must exist in FireID in FIRE
FiremanID in FIRE_Report must exist in Fireman
TruckID in FIRE_REPORT must exist in TruckID in TRUCK
Please, someone tell me if this is right or not. -cheers
View 3 Replies
View Related
Jun 13, 2005
I have a web app which is used to do normal insert/update of employee info. Connected to each employee that is entered is some data that is imported from an outside source for each employee. The question I have is currently my database is very normalized and importing data from this outside source will be quite a pain because of this. Is it bad practice to denormalize a specific table if no user will every insert/update it beside DTS?
View 11 Replies
View Related
Sep 22, 2001
What's my question is ? Whether there are any tools available for normalization produced by Database vendors or any third party. If yes, Can u kindly give me clear documentation.
Thanks,
venkat.
venkat_26178@yahoo.com
View 2 Replies
View Related
Sep 22, 2001
whether there are any tools for Normalization? If yes, Can u please send some documentation or some reference where I can get them.
-venkat
venkat_26178@yahoo.com
View 1 Replies
View Related
Feb 25, 2004
Does this show "poor" design? It has been suggested to me to do a "Logical Model" of my data base and that will make it easier to "normalize" the tables. I tried this and come up with the following but I don't know if I am stretching it too thin. One rule of the 2NF is to ensure all tables have a primary key, and as you can see, my tbProjectTeam has a primary key, but that is made up of the entire row. Same goes for the tbDepartmentActivities.
tbEstimatedProjects
Reference (PK) | Name | City | Postal |...
-----------------------------------------------------------
1 | Some Project | Niagra Falls | N8E7J5 | ....
tbAwardedProjects
Project (PK) | Reference
-------------------------
1001 | 1
tbProjectTeam
Project (PK)| Login (PK) | Activity (PK)
-----------------------------------------
1001 | jsmith | Detailer
tbEmployees
Login (PK) | First | Last |......
----------------------------------
jsmith | Jim | Smith |.....
tbDepartmentListing
Login | DeptCode
---------------------
jsmith | ENG
tbDepartments
Code | Department
------------------------
ENG | Engineering
tblDepartmentActivities
Code (PK) | Activity (PK)
----------------------
ENG | Engineering
ENG | Detailer
Am I taking this too far or is the above structure something to be expected by a "good" normalized table structure?
Mike B
View 6 Replies
View Related
Jul 20, 2005
I've come up with this issue in several apps now. There are things that, fromone perspective, are all handled the same, so it would be desirable that theyall be handled in the same table with some field as a type specification.From other perspective of foreign key relationships, however, they aredifferent things and can't be stored in the same table.For example, I have a scheme for indicating mappings between dimension recordsat one time period to new dimension records at another time period. I coulduse one set of tables for all mappings since they all work exactly the sameway, but then I can't set up DRI between the mapping tables and the dimensiontables. If I just make separate mapping tables for each dimension table, thenI'm creating 4 new tables per dimension table, all identical with respect towhat fields they contain, what kinds of unique constraints they have, and whatrelationships they have to each other with the sole distinction that they eachmap to the integer-type key of a different dimension table. I would not lookforward to doing maintenance on this schema!Is there any strategy for having the cake and eating it, too?
View 7 Replies
View Related
Feb 13, 2008
I have 3 code tables :
create table cd_fiq_a
( fiq_id int not null primary key, fiq_name varchar(50) not null)
create table cd_sal_b
( sal_id int not null primary key, sal_name varchar(50) not null)
create table cd_rak_c
( rak_id int not null primary key, rak_name varchar(50) not null)
insert into cd_fiq_a values (1, 'Fiq1')
insert into cd_fiq_a values (2, 'Fiq2')
insert into cd_sal_b values (1, 'Sal1')
insert into cd_sal_b values (2, 'Sal2')
insert into cd_sal_b values (3, 'Sal3')
insert into cd_sal_b values (4, 'Sal4')
insert into cd_sal_b values (5, 'Sal5')
insert into cd_rak_c values (1, 'Rak1')
insert into cd_rak_c values (2, 'Rak2')
insert into cd_rak_c values (3, 'Rak3')
insert into cd_rak_c values (4, 'Rak4')
Now there is a relationship between cd_fiq_a, cd_sal_b and cd_rak_c. For a given Faq there can be one or more records of Sal. For a given Fiq and a given Sal there can be one or more records of Rak.
I am thinking that i can do it one table or two tables:
One Table Solution
----------------------------
create table relation_d
( relation_id int not null primary key,
fiq_id int not null foreign key REFERENCES cd_fiq_a (fiq_id),
sal_id int not null foreign key REFERENCES cd_sal_b (sal_id),
rak_id int not null foreign key REFERENCES cd_rak_c (rak_id),
sort_order int not null )
Two Table Solution
---------------------------
create table relation_header_d
( relation_header_id int not null primary key,
fiq_id int not null foreign key REFERENCES cd_fiq_a (fiq_id),
sal_id int not null foreign key REFERENCES cd_sal_b (sal_id) )
create table relation_detail_e
( relation_detail_id int not null primary key,
relation_header_id int not null foreign key REFERENCES relation_header_d (relation_header_id),
rak_id int not null foreign key REFERENCES cd_rak_c (rak_id),
sort_order int not null )
Which solution is more normalized and will result in better execution of Sql? Or is there any other solution which is more better?
Thanks
View 11 Replies
View Related