I’m trying to populate my DB with geographical places of my country. One of my tables have 4 fields: ID[PK], latitude. longitude ande geoPoint EDIT `SCDBs`.`Punto_Geografico`; SET @lat = 18.469692; …
SQL query: a stored procedure that receive user ProfileId and get table messages contact list
I need a help with a complicated select query.I have message table CREATE TABLE Message( MessageId int IDENTITY(1,1) NOT NULL, /*primary key*/ FromProfileId int NOT NULL, /*foreign key to …
SQL exception preparing query with ORMLite
I am using an ORM (ORMlite) and all my calls are going well until I get the following error. Exception in thread “main” org.h2.jdbc.JdbcSQLException: Syntax error in SQL statement ” SELECT * …
Calculate business hours between two dates
How can I calculate business hours between two dates? For example we have two dates; 01/01/2010 15:00 and 04/01/2010 12:00 And we have working hours 09:00 to 17:00 in weekdays How can I calculate …
Right query to get the current number of connections in a PostgreSQL DB
Which of the following two is more accurate? Answer Those two requires aren’t equivalent. The equivalent version of the first one would be: In that case, I would expect that version to be slightly faster than the second one, simply because it has fewer rows to count. But you are not likely going to be able to measure a difference.
Freeware Query Builder [closed]
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. Want to improve this question? Update the question so it’s on-topic for Stack Overflow. Closed 7 years ago. Improve this question I’m looking for some freeware Query Builder. Query Builder in Aqua Data Studio allows you to visually build queries: select the column you want
Default value not populating in migration with Rails and Postgresql
I am currently trying to run this migration: class AddDroppedProjectsCountToUser < ActiveRecord::Migration def self.up add_column :users, :dropped_projects, :integer, {:default=>0, :…
SQL query: select five most commented posts from different blogs
I have a following tables Blogs(id) and Posts(id, blog_id, comment_count) I need to select five most commented posts from different blogs. It’s quite easy to do with a function, but is it possible to …
SQL Inserting Data into table
I have a SQL table, let’s call it “Table A”, which has several rows of data. I then have a temp table called “Table b” that has one row of data. I want to be able to do a sql insert so that if Table A …
How do you avoid column name conflicts?
I was recently assigned a task of creating an auction system. During my work, I met numerous occasions where my SQL queries that contained joins failed to execute due to ambiguous column names. …