SELECT `accounts`.`password` FROM accounts WHERE `accounts`.`user`='some_user'
SELECT password FROM accounts WHERE user='some_user'
I am a bit confused about the two. I know as far as the results, there is not a thing different between the two. However is there some reason to do one way as opposed to the other? I learned it the second...
I'm reading from an excel XLS worksheet with no header rows. Some cells in the column have a list of numbers like 12345,12346,12347,12348. Other cells only have one number 12345.
The "LIKE" operator finds the number when there is multiple numbers in a cell, but doesn't find the cells where only one number exists.
SQL = "SELECT * FROM [...
can we define a primary key in a table as a foreign key in that table . I mean,
PRIMARY KEY(ssn),
FOREIGN KEY (ssn) REFERENCES Cust(cust_ssn)
And If we have a table that has some parameters that refers to some other table parameters and to some other 3rd table too. Then Do we need to define those parameters as foreign key referencing...
Hi,
I just needed to double check if there is a limit of characters on EXEC command in t-sql?
If I have a variable with varchar(max) and execute the command using EXEC, you reckon that would be ok?
thanks
...
The Error is: Can't create table c.handsets
How do i find the problem?
I have made a database and I found that my other tables are created in it but only one is giving me this error.
...
Hi I am having difficulties writing a perfect sql query that will search for an address or postcode(english).
I stored my postcode as "W1Y TF7". If a user searches using "W1YTF7" (without the space), it does give me any result when it is suppose to return W1Y TF7.
VENUE
VenueID
Name
Address1
Address2
City
Postcode
PhoneNumer
URL
...
MY data is not being populated into one table in which I have defined foreign keys. Where as in other tables, I have no problem in populating the data.
CREATE TABLE Service (
name CHAR(20),
cityname CHAR(20),
citystate CHAR(20),
using Engine INNoDB in other 2 table where the foreign key is referring to.
...
I'm using SQL Server 2000.
My SP produces the follwing output:
It sums up all Taxable Earnings (top result) and subtract it by the sum of Deductible Expenses (middle result) to get the Net Taxable Income of an employee.
How will I get the value of Net Taxable Income only?
Here's my SP
/*
DECLARE @NET_TAXABLE_INCOME AS NUMERIC(19...
I get the following error below and was wondering how can I fix it?
You have an error in your SQL syntax; check the manual that corresponds to
your MySQL server version for the right syntax to use near '.user_id WHERE
users.active IS NULL AND users.deletion = 0) WHERE users.active' at line 4
And here is my MySQL code (line breaks inse...
When i try to set the Dataset in SSRS IDE, i get the error you see in the snapshot.
The query works totally fine in SQL Server Management Studio, i wonder where did i go wrong?!
The connection to DB is well established.
OPTIONAL:
In case you want to have a look at my query (its too long), i checked it very well. Nothing wrong in ...
Hi Guys,
DECLARE @cityID bigint;
set @cityID = NULL
--set @cityID = 3
SELECT ID,
Name,
CityID,
IsProvince
FROM TABLE t
WHERE ISNULL(t.CityID, -1) = ISNULL(@cityID, -1)
whenever the @cityID is NULL the t.CityID is also NULL for that record.
Only one record can ever be true for IsProvince
Is there a way to...
Hi,
In a sql based query, I need to check that the persons I select from data should have a cell phone with area code 256. How do we check this? I have cell phone numbers as BIGINT.
...
Im looking for something like SELECT PRODUCT(table.price) FROM table GROUP BY table.sale similar to how SUM works.
Have I missed something on the documentations or is there really no product function?
If so I wanted to know the reason why?
Note: I looked for the function in postgres, mysql and mssql and found none so I assumed all sql...
I am trying to do a select which would return a blank '' when a join is not successfull
(when a blank '' or a '-' is
encountered in column)
and return column value when it is successfull. I am using case for this but not succeeding until now. Anyone can advise a better query ?
select a.EmpName,a.deptcode,(a.deptcode||' '||(SELE...
SELECT e.firstName,t.setDate, w.wageAmount
FROM TimeSheet t
INNER JOIN Employee e
ON e.employeeID = t.employeeID
INNER JOIN Salary s
ON s.salaryID = t.salaryID
INNER JOIN Wage w
ON w.wageID = s.wageID
INNER JOIN EmpHiringInfo ehf
ON ehf.EmpHiringInfoID = s....
where h.er = select ( p.er from tip p where p.os = 'Android' OR 'iOS' ) AND h.ssn = (select h2.ssn from persons h2 where h2.ssn like '213%');
I am performing this function in mysql. IT is not letting me to do it. An error is coming like check the manual the mysql version cooresponds to. I am using 5.1.5.1 MYsql
...
I have made an SQL query that picks out web statistics from a database.
This information is being picked out on a weekly basis, outputted as a HTML table and then sent by email.
One of the rows contains the IP addresses of the visitors.
I would like to make the IP address a link leadning to "http://whois.domaintools.com/ip.goes.here".
...
i have some records in a table. some of them have duplicated value in a field.
i want to extract these duplicated values with mysql commands.
how can i do that?
...
I am trying to run this query:
ALTER TABLE table DROP PRIMARY KEY, ADD PRIMARY KEY( `CUSTNO` , `DEPTNO` , `PRODNO` , `DT` );
I get
Incorrect table definition; there can be only one auto column and it must be defined as a key
...
I have a really heavy database, with multiple large tables, and lot of indexes.
We keep constantly adding new indexes, and sometimes the old queries which ran ok at that moment, they come up to use a new index, the wrong for that query.
I am wondering if there is some unit testing out there for MySQL queries, that can track if the resp...