|
select p.pid,p.name,concat('91-',p.phoneno),
case
when (release_date-adm_date)<=5 then 'minor'
when (release_date-adm_date)<=15 then 'medium'
else 'Major'
end as 'type_ailment'
from patient_master p,room_allocation r
where p.pid=r.pid
|
|
|
|
|
Thank You very much it worked.
|
|
|
|
|
Good day to all,
Why tinyint(3) of mysql is treated as sbyte in .net(c#).
I cant find any official datatype mapping for .net and mysql out there.
|
|
|
|
|
|
sorry but still dont get it.
example: var t = typeof(reader[0]);
the "t" is a type of sbyte, i was expecting it to be int or short.
could be the value matter also?
BTW i dont use (example: reader[0].toInt()) for a purpose.
|
|
|
|
|
The link I gave you shows the mapping: tinyint maps to a single byte which, in computer memory, is a signed byte. This allows you to promote it to an integer without the necessity of any data conversion.
Explained in slightly more detail at http://dev.mysql.com/doc/refman/5.1/en/integer-types.html[^].
|
|
|
|
|
ohh thank you so much, now i understand it.
|
|
|
|
|
I'm experimenting with having multiple threads performing INSERTs into a table (no SELECTs, UPDATEs, or DELETEs) and I'm curious how the various IsolationLevels[^] affect performance. I have tried a few and seen no big differences. The documentation and what other information I have seen online (including here) has always seemed pretty vague to me -- and really only talks about reads (which aren't pertinent in this case).
Anyone have any insight on how IsolationLevel affects INSERTs?
You'll never get very far if all you do is follow instructions.
|
|
|
|
|
PIEBALDconsult wrote: and really only talks about reads Because that's what could give trouble; if thread 1 does an partial update on a table, while thread 2 is reading that table - do you want the old or the new values in your result for thread 2?
I don't see any problems when multiple threads insert data. That is, if they are values - if you are reading within that insert-statement (a select, like say, the count of this table), then you might have above problem again.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Eddy Vluggen wrote: if they are values
Right, just simple insertion of values, no reading.
You'll never get very far if all you do is follow instructions.
|
|
|
|
|
Rec_ID Rec_Name Dist_ID
1 A 1
2 B 1
1 AA 2
2 AB 2
3 C 2
How can i write a Insert sql script for this table, eg: i should insert Rec_ID 3 while inserting Record for Dist_ID 1 and also Rec_ID 4 for Dist_ID 2, Suppose if many users inserting from different places, how to handle this situation. what is the best method? I have following 2 ideas, which is right idea or is there any other method to implement this
1) Select Max(Rec_ID) for the district, suppose if 2 people inserting at the same time will be a issue.
2) Put a Lock in the Stored Procedure
|
|
|
|
|
Specifying Rec_ID as an identity[^] column may do all of that work for you.
“That which can be asserted without evidence, can be dismissed without evidence.”
― Christopher Hitchens
|
|
|
|
|
I Cannot set it as Identity column, because based on the District ID should get the Next Rec_ID
|
|
|
|
|
In which case I do not understand what you are trying to do.
Can you specify exactly what you need with a before and after example - thanks.
“That which can be asserted without evidence, can be dismissed without evidence.”
― Christopher Hitchens
modified 6-Jun-14 9:14am.
|
|
|
|
|
I'm with Guy. This does not make any sense.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
Wrong order.
Insert the records in the dependent tables first, and get their identity. Then insert the REC using the identities you fetched.
Inserting data in multiple tables, appearing as a single atomic operation would require a "transaction".
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
And if the workload isn't too heavy you could use a Web Service (WCF or similar) to provide a single access point so the clients don't actually touch the database. The service could then perform the actions one-by-one.
You'll never get very far if all you do is follow instructions.
|
|
|
|
|
I have the following three tables:
TABLE_A TABLE_B TABLE_C
------- --------- -------
id (primary) tablea_id (foreign) tablea_id (foreign)
name boards text
date
phone
I have the following query to select all rows from TABLE_A and also count how many related rows are in each of the other two tables:
SELECT *, (SELECT COUNT(TABLE_B.tablea_id) FROM TABLE_B WHERE TABLE_B.tablea_id == TABLE_A.id) AS Cnt1, (SELECT COUNT(TABLE_C.tablea_id) FROM TABLE_C WHERE TABLE_C.tablea_id == TABLE_A.id) AS Cnt2 FROM TABLE_A
This works fine, but I was curious if: 1) SQL was doing three separate queries behind the scene, and 2) a more efficient way exists.
Thank you.
- DC
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
If you turn on the Execution Plan SSMS will show you the 3 queries and their relative costs. I often use this tool to compare the performance of queries constructed differently to do the same job.
I would use 3 union queries but I'd bet the cost is identical on such a simple query.
Sorry I missed the SQL Lite platform in the title
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Mycroft Holmes wrote: Sorry I missed the SQL Lite platform in the title That's okay. I could've qualified it further by stating it's running on an Android platform.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
Ok
this is probably going to be the easiest answer you guys have ever given bit i am finding this concept difficult i guess it just isnt clicking
http://prntscr.com/3ps60e[^]
^picture of the table i have a question about
i am trying to fine the canidate key and the functional dependency in this table :/ i understand what a functional dependency is but cant figure out how it relates to this table for instance
CookieCost = NumberOfBoxes X $5
i know that cookie cost is functiolly dependent on the number of boxes
but yea i suppose if you could tell me the answer but more importantly HOW you got that i would REALLY appreciate it
|
|
|
|
|
Member 10865129 wrote: i know that cookie cost is functiolly dependent on the number of boxes That goes for all calculations, but that's not what's meant in the context of normalization.
Member 10865129 wrote: i am trying to fine the canidate key and the functional dependency in this table The table should be in 0NF first, in which case it needs a name. To find the candidate keys, you'd make a list of the fields that can be used to identify a unique record.
They look like meetings. What fields would the you combine to get a unique meeting - no, rephrase, which of those facts does the user require to uniquely identify an entry? If I'm not mistaken, then it's a compound key.
Next you'll be hunting for fields that are functionally dependent on a part of that key; they need to be moved to their own table (if there are any, and yes, I seen one) Ask yourself for each non-key field the question: "does this fact depend on the complete cadidate key, or is it determined by part of the candidate?"
Easy explanation; http://support.microsoft.com/kb/283878[^]
Complex explanation; http://en.wikipedia.org/wiki/Functional_dependency[^]
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Member 10865129 wrote: more importantly HOW you got 0 NF:
Attorney | ClientNumber | ClientName | MeetingData | Duration | Boxer | 1000 | ABC, Inc | 11/5/13 | 2 | Boxer | 2000 | XYZ Partners | 11/5/13 | 5.50 | James | 1000 | ABC, Inc | 11/7/13 | 3 | Boxer | 1000 | ABC, Inc | 11/9/13 | 4 | Wu | 3000 | Malcomb Zoe | 11/11/13 | 7 |
1 NF:
* Remove all calculated facts
* Assign a key
* Move repeating groups to their own table
(key is underlined)
Attorney | ClientNumber | MeetingData | Duration | Boxer | 1000 | 11/5/13 | 2 | Boxer | 2000 | 11/5/13 | 5.50 | James | 1000 | 11/7/13 | 3 | Boxer | 1000 | 11/9/13 | 4 | Wu | 3000 | 11/11/13 | 7 |
ClientNumber | ClientName | 1000 | ABC, Inc | 2000 | XYZ Partners | 3000 | Malcomb Zoe |
2 NF:
* Find the attributes that are not "functionally dependent" on the entire key
That means that we look at each non-key field and ask ourselves whether or not it is depending on the entire key, or whether it can be identified with a part of that key.
The only non-key field in "Meetings" is called "Duration". The duration "2" belongs to the meeting that's identified with all three fields, so there's no functional dependency there. In the original table the duration could depend on a part of the key; my mistake.
3NF:
* Find non-key fields that depend on other non-key fields.
There's none.
One might argue that the Attorney is also a repeating group, and put it in it's own table with an artificial key.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
I have created SSIS package and deployed in SQL Server 2008 in a seprate server, and that package is called using ASP.NET which is different web server, in this web server i have already installed Integration Services, but still when i load the package i am getting below error message.
package errMicrosoft.SqlServer.Dts.Runtime.DtsComException: An Integration Services class cannot be found. Make sure that Integration Services is correctly installed on the computer that is running the application. Also, make sure that the 64-bit version of Integration Services is installed if you are running a 64-bit application. ---> System.Runtime.InteropServices.COMException: Retrieving the COM class factory for component with CLSID {BA785E28-3D7B-47AE-A4F9-4784F61B598A} failed due to the
following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)). at Microsoft.SqlServer.Dts.Runtime.Application..ctor()
can you please help if am missing any settings or runtime service to be installed in web server.
Below is my code that is used to execute the SSIS Package.
Dim pkg As Package
Dim app As Application
Dim pkgResult As DTSExecResult
app = New Application()
pkg = app.LoadFromSqlServer("\\" & SSISPackageName, DB_ServerAddress, Nothing, Nothing, Nothing)
pkgResult = pkg.Execute()
If (pkgResult = DTSExecResult.Failure) Then
For Each local_DtsError As Microsoft.SqlServer.Dts.Runtime.DtsError In pkg.Errors
Next
End If
Shuaib
|
|
|
|
|
Hello All,
I tried using '+' operator for left outer join in MySql Workbench 5.2 CE but it is giving me a syntax error.I want to know whether + operator is supported by MySql Workbench 5.2 CE or not?I have gone through the manual of workbench but I did not find any information on this topic.Kindly help me with it.
|
|
|
|