Tagged Questions
-4
votes
1answer
29 views
First 5 entries for a single user
I am using PostgreSQL. I need to get the dates for the first 5 transactions of every user on my DB.
Transaction - trans.id, trans.date, trans.cust_id, trans.value
Customer - cust.id, cust.created_at
...
-1
votes
0answers
24 views
Drupal 7, PDOException: SQLSTATE[25P02]
After migrate from mysql to PostgreSQL (DBTNG Migrator module) i get errors:
PDOException: SQLSTATE[25P02]: In failed sql transaction: 7 ERROR: current transaction is aborted, commands ignored until ...
0
votes
3answers
72 views
How is postgresql different than mysql? [on hold]
We are currently working on a project that requires transferring a MySQL database to PostgreSQL. I have never worked with PostgreSQL.
My questions are:
Would my MySQL knowledge be enough to handle ...
-6
votes
0answers
18 views
PostgreSQL and MySQL [on hold]
I know there are a some documentation online, but I'm a rookie in database. Can anyone please explain what's the high level differences between PostgreSQL and MySQL? When should I use each?
1
vote
1answer
26 views
django postgresql query not working
I have a postgreSQL database that has a table foo that I've created outside of django. I used manage.py inspectdb to build the model for table foo for me. This technique worked fine when I was using ...
0
votes
1answer
53 views
How to get table name from current query in php or postgresql
is it possible to get table name from current query using pdo php or normal sql in postgresql?
In pdo php a function exists like PDOStatement::getColumnMeta but this function doesn't work well, ...
1
vote
1answer
14 views
How to get database data transfer stats in PostgreSQL and MySQL?
I would like to know how to get database data transfer stats in PostgreSQL and MySQL.
Like for example I need to know how many bytes are transfered per day/week/month.
Thanks in advance! Regards.
0
votes
2answers
33 views
How can we switch columns when first is Null
How can we direct the command to second column when first one is NULL for extracting the data, and the second column is Joined with another table through Join Command.
Select
competitions.name as ...
-1
votes
2answers
19 views
format query in postgres
$query1 = pg_query('SELECT "id","location",ST_Distance_Sphere(ST_Point(lat,long ), ST_Centroid("path"::geometry)) FROM places
ORDER BY ST_Distance_Sphere
LIMIT 1');
echo $query1
...
0
votes
1answer
15 views
Installing PostgreSQL ODBC drivers on mac for use in the MySQL Workbench Migration Wizard
I want to use the MySQL Workbench Migration Wizard to convert a PostgreSQL database into MySQL, but am unable to correctly install the odbc drivers. I downloaded the tarball and followed the ...
1
vote
0answers
152 views
Should I use a Pivot Table or a new table - Entity Supplied
I am seeking advice, so that i move forward in the right direction.
I am implementing the Party relationship Model in MySQL.
Parties can be people or organisations and can have many contacts and ...
2
votes
2answers
43 views
How do you combine multiple Rails SQL queries into a single query in rails?
In my rails code, I need to run a query on a table based on a combination of the date of the records and votes that the record has received. I accomplish it like the following in rails:
if ...
0
votes
2answers
24 views
Save an array as a string or use multiple tables?
I am new to database design and I am using php and laravel in particular with mysql as my db layer.
I want to allow people to create and save training programs. each program can have multiple weeks, ...
1
vote
1answer
33 views
ActiveRecord::Base SQL result object types different in MySQL and PostgreSQL
Am I missing something? Same console, same codebase, different database connections. Result: different object types returned. If MySQL is used, we get an array of arrays, if PostgreSQL is used, we ...
1
vote
2answers
46 views
Cannot isolate JDBC memory leak in Scala bulk data loading application
I had written a sensor network webservice in Scala (it's my first Scala app; yes I know it uses Spring Dependency Injection. I'm in the process of ripping a lot of that out. Don't judge). Anyway, the ...
0
votes
0answers
24 views
PHP PostgreSQL search showing HTML Link?
I've been looking around a lot of places to find out how this would work but can't seem to find it.
What I want is to show a link after the user searches for products. I got the link to work with ...
1
vote
1answer
27 views
PostgreSQL - Help Required in Creating View
I'm creating a view here.
Here's a example.
Table1 :
time,date,label,count
12:00 AM,1-Jan,A,10
12:30 AM,1-Jan,A,10
1:00 AM,1-Jan,A,19
1:30 AM,1-Jan,B,14
2:00 AM,1-Jan,B,18
2:30 AM,1-Jan,B,13
3:00 ...
0
votes
1answer
24 views
UPDATE with nested query in PostgreSQL with unwanted results
Due to its geographic capabilities I'm migrating my database from MySQL to PostgreSQL/PostGIS, and SQL that used to be so trivial is now are becoming painfully slow to overcome.
In this case I use a ...
1
vote
4answers
74 views
Is there a performance hit using decimal data types (MySQL / Postgres)
I understand how integer and floating point data types are stored, and I am guessing that the variable length of decimal data types means it is stored more like a string.
Does that imply a ...
0
votes
1answer
66 views
Laravel 4 - Case Sensitive Database Columns
Hi i am having problem with the case sensitive eloquent, i am developing i small program that can use mysql and postgres databases, The problem is if i use mysql everything is okay, but if i use ...
0
votes
3answers
35 views
Table Values() Constructor for Updating Multiple Rows
I just moved an app from a local instance where I used Postgres to a Google Compute Engine virtual instance where I'm using Google Cloud SQL, built on MySQL.
Ever since the move, this SQL query is no ...
0
votes
4answers
46 views
Unable to ECHO PostgreSQL Query Results - PHP
I've successfully connected to a PostgreSQL database and even the query is running successfully.
But when I try to print the data using this code echo $data I get error as Array to String Conversion.
...
1
vote
2answers
36 views
How to insert as much values into another table as it's definied in a specific colum from other table
I have two tables, Movements and sales
Movements (example)
clock_model| piece_ref| original_stock |
-----------+----------+-----------------
R0000000000| 0000ZZZ | 5 |
Sales (I just ...
0
votes
1answer
16 views
Thumbs up/down on multiple elements
I am building a music application. In my database I have an "Artist" table, related to an "Album" table, related to a "Track" table.
Each user of my application can "like" (thumbs up) or "dislike" ...
0
votes
1answer
56 views
Why unsigned integer is not available in PostgreSQL?
I came across this post (What is the difference between tinyint, smallint, mediumint, bigint and int in sql?) and realized that PostgreSQL does not support unsigned integer.
Can anyone help to ...
0
votes
2answers
38 views
How to avoid double quotes to column name in postgreSQL?
I am new to work with PostgreSQL. I faced the problem while executes the query (column not found) when I migrate the database from MySql to PostgreSQL.
ie, in MySQL I have on the table name provider ...
3
votes
2answers
83 views
How to use indexes for a query filtering BETWEEN two columns
I need a generic sql query for joins that can run on mysql, postgres and other major DBs.
I have a table named autumn4.ip with three columns: id, start, end (all ints).
How do I make a join so that ...
0
votes
2answers
32 views
any api to get geo location by ip, that relies on a database table and ranges
I need a table to find the geo location of a person. I used maxmind api algorith and a table given which had numeric numbers (representing ips when the user ip is also converted to an integer).
The ...
-2
votes
2answers
55 views
How to translate MySQL regexp to Postgres?
I have such MySQL query:
'... WHERE
LOWER(users.name) REGEXP LOWER(" '.$q.'") OR
LOWER(users.name) REGEXP LOWER("^'.$q.'") OR
LOWER(users.login) REGEXP LOWER("'.$q.'") OR
...
0
votes
1answer
44 views
How to use pgrypto in postgres to hash password
I usually hash password+salt with sha1 and inserted password hash and salt into MySQL database. Now I have to use postgres in new project (PHP project) and I get known, there are better ways to salt ...
0
votes
2answers
37 views
How to request a database schema via SQL query on popular SQL platforms? [closed]
Is there a SQL query that returns the schema of the current database? Like with columns "table", "name", "type", etc.
The platforms in question are MySQL, PostgreSQL, SQLite, and T-SQL.
1
vote
1answer
30 views
web2py dal howto define model at runtime
I am a newbie to wewb2py,is it possible to create at runtime a model of a legacy database, for using DAL with it? I saw that there are some scripts that create the model file, but I do not know ...
0
votes
0answers
24 views
alfresco strange fields in database (alf_node_properties)
I have strange fields in alfresco database (mysql), tables alf_node_properties (serializable_value) and act_ge_bytearray (BYTES_)
in ACT_GE_BYTEARRAY (BYTES_) type longblob
�� sr ...
1
vote
2answers
54 views
COALESCE(FIELD, “DEFAULT VALUE”) not workin for postgresql + rails
sql = "SELECT DISTINCT(p.*), concat(u.first_name,' ',u.last_name) as fullname, concat('@',u.username) as username, cover.file_path, cover.file_type, avatar.avatar_path
FROM products p
...
0
votes
1answer
15 views
postgres query record by specific date
was using postgres..
I got the columns similar like below
start_time: "2013-11-30 03:51:00"
But I having date which ruby generated
Date.today -> Mon, 16 Dec 2013
How do I trigger records ...
0
votes
0answers
38 views
SUM for each row and filter result SUM() IN $x
My table in MySQL with data:
id user_id sell_amount sell_currency_id buy_amount buy_currency_id type status date_add
5 2 2.00000000 1 4.00000000 0 0 0 2013-12-15 19:06:40
6 3 ...
0
votes
0answers
22 views
Pulling a MTD query in postgres using heroku data clips
Extremely new to postgres so I apologize..
The person before me set up data clips in heroku pulling our new active users per day. I need to pull the cumulative active users, active users in the last ...
0
votes
0answers
44 views
Rails 4 has_many :through subquery postgres
The end result here is simple: I want to sort the "manies" of a has_many by votes (which are obviously stored in a separate has_many, keyed off the join table)
I am new to rails, so I'm thinking I am ...
0
votes
2answers
24 views
Calculate the overlap between two unrelated tables in posgres/posgis
This is both a basic SQL question and a postgres/postgis question.
I have two table sets, in the same database but from different sources, provide similar yet different geographic data.
For ...
2
votes
1answer
75 views
Ordering by more than one field?
i have this query
SELECT * FROM
(SELECT u.id,u.email,u.verified,u.verified_on,u.created_on,ca.html AS age,cg.html AS gender,cs.html AS state
FROM users u
LEFT JOIN combo ca ON ca.combo_group='age' ...
0
votes
2answers
56 views
Check SQL constraint value
Is it possible to check a specific value of an existing constraint?
For example I want to check if a FOREIGN KEY Constraint is ON DELETE SET NULL or ON DELETE NO ACTION.
I only found solutions if a ...
-1
votes
6answers
94 views
Do we need both PHP and database user input validation? [closed]
When developing a webapplication we usually implement data validation both in PHP scripts and in our database (as constraints and triggers).
Do we really need to repeat this task twice? What is the ...
0
votes
1answer
62 views
Rails Change Column Type Migration for Both MySQL and Postgres
I have a rails application which is running on different databases depends on client preferences. I have a "catalog_item_specifications" table which has a column "bec_id". The type of the column is ...
0
votes
2answers
37 views
SELECT CASE and use in a CONDITION
Is it possible to have a SELECT CASE STATEMENT and then use THAT column in a WHERE condition?
something like:
LEFT JOIN (
SELECT student_id
,
CASE
WHEN (
consent_type = 'Medicaid'
//condtion ...
-1
votes
1answer
59 views
RDBMS: RAID vs Table Partitioning for a Single Huge Table
We have a single huge table around 10 TBs in which each row is approximately 10 KB.
The primary key's type is BIGINT and it is uniformly distributed.
The server has 40 GBs of RAM, two 4-core Xeon ...
0
votes
1answer
27 views
What algorithm or pattern to use to check what rows in what tables will be cascade deleted in mysql/pgsql?
So the question - I have a lot of tables in database and almost all of them have on delete cascade. What is the best way to inform user what will be deleted in entire database if he deletes one ...
0
votes
1answer
34 views
Rails table indexes are not foreign keys in database as expected - why?
I have created tables for user and attendance (Users, Attendances) and all is good. A user has many attendances and an attendance belongs to user. The code works and Rails works but there is one big ...
1
vote
1answer
178 views
Which database to use with Django and Python 3? [closed]
I'm writing my first application with Django and Python 3.3.3. I've always used MySQL for others projects, but it seems to have some problems with Python 3.X and MySQL :
At the time of writing, ...
2
votes
1answer
56 views
Concept design for a MMO java engine
We are building a HTML5 MMO that will leverage AJAX calls to a REST API written in Python for actions ( buy, sell, build, trade, send , attack).
Our second part of this project is a Java Server that ...
0
votes
1answer
42 views
if no file upload, file id in database should be: placeholder.gif
i have a form where you can put an image uploade, which is optional. with this script at the moment it writes upload/timestamp into my database. but i need to replace that with a placeholder if no ...