There are two tables A and B. You are retreiving data from both tables where all rows from B table and only matching rows from A table should be displayed. Which of the following types of joins will you apply between A and B tables?
- Inner join
- Left outer join
- Right outer join
- Self join
...
Hi,
When i ran the below queries it's failing in the second query becuase prev_test_ref1 variable is not defined. If i remove the insert statement in the first query ,run again then it's working and using the prev_test_ref1 value from the first sql query in second query. Is it because of variable scope? How can i resolve this with...
2
Hi! I am trying to create stored procedure that gone return varchar value, and that value I need to display in textbox.
This is the code for stored procedure:
Create PROCEDURE Status @id_doc int, @Name varchar(50) OUTPUT
AS
select @Name =items.name
from Doc,Items where @id_doc=IDN and doc.IDN=Items.ID
return @Name
This is t...
When a table is dropped using a simple DROP statement, SQL performs some more operations simultaneously, select all the valid operations?
a. Removes all rows from the table
b. Drops all the table's indexes
c. Removes all dependent views
d. Removes all dependent procedures
...
Hello All,
I am facing a problem in executing queries with CASE statement.
Based on my condition,(for eg. length), I want to execute different SQL statement.
Problematic sample query is as follows:
select case
when char_length('19480821') = 8
then select count(1) from Patient
when char_length('19480821')=10
th...
I have a database table containing credit card records. One of the fields is a Date field. I would like to update this field by changing the year portion of the date to 2011 if the year is less than 2010. From what i have found, PLSQL has functions for time and months but nothing to do with years (to my knowledge).
...
In application all sql connection close properly, Also when user log out its connection close still sql process memory increase in RAM and after some time Application slow down.
...
I am working within the confines of a php based CMS like system, which defines custom form fields that can be used when making a new page.
I have two tables in my database, one called people, which has three fields, firstname, middlename and lastname, and a second table called orders, which also has firstname, middlename and lastname fi...
How can you get the exact rows affected by an SQL UPDATE statement in MySQL?
I have many clients on many computers that can be updating rows in the same table based on WHERE clauses at any time, and each client needs to do something in another system for each row that they affect, so getting the list of affected items must be accurate a...
I have a stored procedure which selects a single field from a single row (based on a conditional statement) and stores it in a local variable. Based on the value of this field I update the same field in the same row of the table (using the same conditional statement). So the procedure first does a select into a local variable and then ...
I have a google suggest type of input field, which displays records)the result of an SQL query) as I type input. I can then select one, and what I select becomes the content of that field.
I would like to know how to push the content of that variable back to my PHP form using jquery.
I am working in the confines of phpBMS, a type of CM...
I have readonly access to the master database however the following query only returns a subset of users. What permissions are needed to return the rest of the users?
SELECT [name] FROM master.dbo.syslogins
...
I'm using SQL Server 2008 and I have 3 tables, x, y and z. y exists to create a many-to-many relationship between x and z.
x y z
-- -- --
id xid id
zid sort
All of the above fields are int.
I want to find the best-performing method (excluding denormalising) of finding the z with the highest sort for ...
I have been doing a coding in for last 7 months. Most part of it has been the updations to the very poorly coded software in asp. Now I am going to redevelop entire software in asp.net. I want it to be very efficient. I need some tips and guidance about how to plan project and design a good database. Thanks in advance for help.
...
Ok this is weird, I know. I just want ideas about how to deal with it.
I want to do a join
--- ---
A B
--- ---
id id
idB
--- ---
A standard join would be :
SELECT *
FROM B
JOIN A ON A.idB = B.id
WHERE A.id = 3
But here, my idB is not an int foreign key, it is PHP serialized.
For example, instead of being 5, it is "i...
OK, so I think I'm going mad here! Here's where I am.
SQL Server 2008: I've set up Database Mail, and I've sent myself a test email. Simple, works fine.
I've created an operator, called 'Tom'. I've given it an email address (but nothing else).
However, when I run this command:
EXECUTE msdb.dbo.sp_notify_operator @name=N'Tom',@subj...
i am trying to run a query in another server and need to specify it in the select statement but the server name has got an '-' in it, like server-name.
this is producing the error in the title.
How can i fix it?
...
In SQL, you can use the following syntax:
SELECT *
FROM MY_TABLE
WHERE VALUE_1 IN (1, 2, 3)
Is there an equivalent in C#? The IDE seems to recognise "in" as a keyword, but I don't seem to be able to find any information on it.
So, is it possible to do something like the following:
int myValue = 1;
if (myValue in (1, 2, 3))
// D...
Hi,
I use Zend_Db_Select to perform a query with a Join. I end up with the following SQL query :
SELECT `Utilisateur`.*, `Ressource`.*, `Acl_Cache`.*, `Role`.*, `UtilisateurRole`.* FROM `Utilisateur`
INNER JOIN `Ressource` ON Ressource.idJointure = Utilisateur.id
INNER JOIN `Acl_Cache` ON Acl_Cache.idRessource = Ressource.id
INNER JOIN...
In my database i have a TIMESTAMP field.Now I want to find the difference between the value stored in this field and the current TIMESTAMP .I want the result in days.
How can i get it?
Note:I am using DB2 database
...