Skip to main content

All Questions

0 votes
1 answer
171 views

Overlaying rows in SQL

So, I want to store sets of key-value pairs in a database and then retrieve a combined set of the key-value pairs based on a series of sets. Each set might not be complete. Let's say we have a table ...
kjpires's user avatar
  • 740
1 vote
2 answers
173 views

How to verify if DB remote server is running using only java raw sockets [Telnet]

I wanted to explore an option to write minimal code to check if db2 server is running using plain java sockets. Just like doing telnet to server. It seems db2 is not configured to respond for telnet ...
Nitesh Suresh's user avatar
1 vote
2 answers
91 views

Is it really needed to define a column as foreign key in all tables where it is used

I have a users table which has user_id as primary key and it is used in other 40 to 50 tables(approx.). Is it necessary to define user_id column as foreign key in each and every table where user_id is ...
SKG's user avatar
  • 184
0 votes
1 answer
235 views

Developing a comprehensive set of SQL statements/queries based on Sakila or other standard database [closed]

I'm developing a comprehensive set of SQL statements/queries based on Sakila or other standard database. I'm testing a number of DB Connectivity Drivers, against different DBs (i.e. MySQL, Oracle, ...
where_'s user avatar
  • 301
1 vote
2 answers
73 views

Select single row with multiple rows in joined table

I have a contact table as below: contactid | contactname ----------|------------- C1 | Name1 C2 | Name2 I have a communication table as below contactid | communication_type | ...
Rama's user avatar
  • 19
-4 votes
2 answers
70 views

Select from two tables joid vs Joining two Selects

I always see people use these two ways for joining two or more tables. select * from BOOKS as B where B.name = 'GOOD BOOK' inner join select * from AUTHOR as A where A.AUTHOR_NAME = 'GOOD AUTHOR' on ...
keem_14's user avatar
-2 votes
2 answers
237 views

query to obtain final status as fail when any one of listed subject is failed

Select count(course),course,dept, Case When ****condition*** then 'passed' Else 'failed' End as finalstatus from college group by course,dept; Here condition should check each subject of each ...
adonthula's user avatar
  • 117
0 votes
3 answers
83 views

Subquery Issue while fetching the columns from 3 tables

I have 3 tables x,y,z x has username, fullname y has username, comm, time z has fusername, musername I want to select x.fullname, x.username, y.comm, y.time where the inner joined fields are x....
Sity's user avatar
  • 1
0 votes
1 answer
70 views

sql query for n rows plus another a row with id

I have a query, which return (say)10 rows SELECT EL.ID AS ID ,EL.x AS x ,EL.y AS y,EL.z AS z, EL.k AS k, EL.a AS a, EL.b AS b ,EL.c AS c,EL.d AS d ,EL.e AS e , ...
pvsnambiar's user avatar
-1 votes
2 answers
132 views

How to set the maximum disk size of a database MySQL, Oracle, PostGreSQL or DB2? [closed]

This is how I do in SQL Server: Create Database MyDatabase on (Name='MyDatabase_Data', Filename='c:\db\BdUnisanta_Data.mdf', Size= 20MB, FileGrowth = 10%, Maxsize=100MB) log on (...
Yure Pereira's user avatar
1 vote
4 answers
6k views

Compare table content with external file- SQL

I have an Excel file with users IDs, called users Excel. In the Database I have a users table: this table holds the data from the users excel file and from another file (administrators file). I ...
user3165438's user avatar
  • 2,661
0 votes
1 answer
279 views

How can I achieve unicode normal form C with collation in MySQL, db2, Derby or Oracle databases?

I have tried using different collation methods across different implementations of SQL databases, but am unable to achieve complete normalization. Does anyone have any tips for this in any of the ...
whwright's user avatar
  • 561
0 votes
2 answers
147 views

Converting between clause to joins [duplicate]

Need a generic sql query for joins that can run on mysql, postgres and other major DBs I have a table named autumn4.ip , I have three columns: id,start,end (all ints). How do I make a join so that I ...
Masood Ahmad's user avatar
7 votes
2 answers
1k views

Which DBMS's allow an order by of an attribute, that is not present in the select clause?

Let's assume I have a table called Cars with 2 columns: CarName, BrandName Now I want to execute this query: select CarName from Cars order by BrandName As you can see, I'd like to return a list, ...
citronas's user avatar
  • 19.4k
2 votes
4 answers
1k views

Insert query based on number of rows

I want a query to insert a row into a table I know it is simple but the scenario is the table should not have more than 5 rows. If table has more than five rows I need to remove the old row(Or replace ...
Karthik207's user avatar

15 30 50 per page