I am using SQLite and will port to MySQL (5) later.
I wanted to know if I am doing something I shouldn't be doing. I tried purposely to design so I'll compare to 0 instead of 1 (I changed hasApproved to NotApproved to do this, not a big deal and I haven't written any code). I was told I never need to write a subquery but I do here. My ...
my table is:
[tableAbc]
A B C
------------
1 a b
2 c e
3 e r
...
run:
show create table tableAbc;
to get the create table sql
but how to get insert sql?
like:
insert into `tableAbc` ('A','B','C') VALUES(1,'a','b');
...
any idea? (or any java library to do this)
thanks all!
BTW:
i want show the "insert sql" to web brower.
so...
Hi,
I wan't to compare two strings in a SQL request so I can retrieve the best match, the aim is to propose to an operator the best zip code possible.
For example, in France, we have Integer Zip code, so I made an easy request :
SELECT *
FROM myTable
ORDER BY abs(zip_code - 75000)
This request returns first the data closest of Paris....
HI, i have two tables
1- name, id, code
2- id, value, concept
One name can have two concepts and two values. i want to retreive this:
Id, name, value1, value2.
How can i do that?
Tanks
...
I have a table in SQL server which has a DATETIME field called Date_Printed. I am trying to get all records in the table which lie between a specified date range. Currently I am using the following SQL
DECLARE @StartDate DATETIME
DECLARE @EndDate DATETIME
SET @StartDate = '2010-01-01'
SET @EndDate = '2010-06-18 12:59:59 PM'
SELECT ...
I am creating a application that requires to store multiple attributes, and it will look up DB while running (this means multiple DB lookups). This App. should have low overhead hence, I need your suggestion whether to create multiple columns in single table or multiple tables with minimum columns.
...
Hi,
can Hibernate generate uppercase SQL?
I.e. some option which would make it send
SELECT table1_.prop1_ FROM my_table AS table1_;
instead of current
select table1_.prop1_ from my_table as table1_;
which I consider far less readable, esp. for long queries HBN tends to spit.
See also https://forum.hibernate.org/viewtopic.php?f=1&...
Based on the following table
id Title Date Metadata
------------------------------------
1 A 08/01/2010 M1
1 A 10/05/2010 M2
1 A 03/15/2011 M3
2 B 09/20/2010 M1
2 B 01/15/2011 M2
3 C 12/15/2010 M1
Input variables will be start and end date. S...
I don't understand why sometimes Transfer.ScriptTransfer() generates a script where some CREATE VIEW statements come even before the actual table declarations.
How's that possible?
...
I am new to SQL so hopefully this has an easy answer.
I have a Students table (studentID, name, statusID) and a StudentsClasses table (studentID, classID). I've been asked to create a view from the above tables that returns the following columns:
classID: (group-by)
count of students in each class AS Students
count of students w...
I have two tables that need to be updated, Master and Identifiers:
Master
--MasterID (PK)
--ModifiedDate
--ModifiedBy
Identifiers
--IdentifierID
--MasterID (FK to Master)
--Identifier
--IdentifierType
--ModifiedDate
--ModifiedBy
The Master table's sole reason for existence is to tie different Identifiers to a single person.
I receive...
Hi, I'm trying to update a field in one table, from the sum of another field, in another table.
company_tbl (PRIMARY, companySize, companyName)
location_tbl (PRIMARY, companyID, locationSize, locationName)
The two tables link by company_tbl.PRIMARY = location_tbl.companyID
update company_tbl comp, location_tbl loc
set companySize = su...
How do I capture the output from the following SQL statement so I can query the resultset?:
RESTORE FILELISTONLY FROM
DISK = N''D:\Restores\MyBackup.BAK'' WITH NOUNLOAD,
FILE = 1
Do I need to create a temporary table and then do something like?:
INSERT #tmp EXEC ('RESTORE FILELISTONLY FROM
DISK = N''D:\Restores\KevsP...
Hello friends I am getting the following error while making the foreign key
'tbl_course' table saved successfully
'tbl_students' table
- Unable to create relationship 'FK_tbl_students_tbl_course'.
Introducing FOREIGN KEY constraint
'FK_tbl_students_tbl_course' on table
'tbl_students' may cause cycles or
multiple cascade p...
I am very confused about making choice between being a Oracle DBA or SAS Data Analyst. I've got B.Sc.Maths degree and have decided to make inroad in computer and some friends have suggested me SAS as better option than DBA. But I have heard that DBA is money and job stability-wise better than a data analysyt. I have no very much programm...
I need help with my MySQL query:
CREATE OR REPLACE
DEFINER = CURRENT_USER
VIEW users_phpscheduleit
AS
SELECT
u.uid AS memberid,
pass AS password,
mail AS email,
pv1.value AS fname,
pv2.value AS lname,
pv3.value AS phone,
e_add, e_mod, e_de...
Working in MS SQL 2005 and I want to use a select statement within a wildcard where clause like so:
SELECT text
FROM table_1
WHERE ID LIKE '%SELECT ID FROM table_2%'
I'm looking for product ids within a large body of text that is held in a DB. The SELECT statement in the wildcard clause will return 50+ rows. The statement above is o...
I am trying to write a Dynamic Query which uses a CTE. But I am facing problems - see below
This is a simplified case
declare @DynSql varchar(max)='';
declare @cnt as integer;
with months as (
select CAST('07/01/2010' as DATE) stdt
UNION ALL
SELECT DATEADD(MONTH,1,STDT) FROM months
WHERE DATEADD(MONTH,1,STDT)<CAST('06/30/2011' AS DATE)
...
So I want to get the row with the most recent date, max(asofdate) but I am MySQL illiterate and can't seem to get it. It my head
select * from Reports.InternalLoanExposureFlat where asofdate = max(asofdate) seems to make sense but the console seems to disagree with me.
Thanks in advance.
...
Based on the following table
Title Jul-10 Aug-10 Sep-10 Oct-10 Nov-10 Dec-10 Jan-11 Feb-11 Mar-11 Apr-11 May-11 Jun-11
--------------------------------------------------------------------------------------------
A Null M1 Null M2 Null Null Null Null M3 Null Null Null
B Null M1 Null N...