1
vote
1answer
23 views

Database query: join tags with exact matches or at least one

Given I have a query like: SELECT count(mm.id) AS c FROM merchant_mobile mm INNER JOIN mobile m ON mm.mobile_id = m.id LEFT JOIN merchant_mobile_customer mmc ON (mm.id = mmc.merchant_mobile_id) INNER ...
1
vote
1answer
31 views

How to shard a database like that of SO?

I know a bit about sharding but I cannot wrap my head around that fact that say eventually SO cannot scale vertically then how would they shard their SQL DB? Even if we assume SO will not reach that ...
0
votes
1answer
15 views

Can't create user in oracle

i'm using oracle xe edition at ubuntu 14.04. I'm trying to create a user using my sysdba account but when I type the command create user 'myuser' identified by '******'; it gives the error message ...
0
votes
0answers
59 views

MySql: Get count of incremented items by multiple conditions

Here's the create and insert script, it's a calls record data table. This is a glimpse of it: | call_id | customer | company | call_start | ...
0
votes
1answer
21 views

Using part of a compound key as foreign key

We have the following situation, in which we have three tables: Article ------- - Id (PK) - Supplier_Id - Supplier_Contactperson_Id - Name Supplier --------- - Id (PK) - Name SupplierContactperson ...
0
votes
0answers
51 views

sql join without combining all rows

I've searched questions but can't seem to apply to my scenario. Please see attached code below. I am trying to join two subsets of this data but am getting duplicates/too many rows please see ...
0
votes
1answer
22 views

Is there any way to change the size of preallocate data file in mongodb?

In mongodb data files are preallocates to a particular size,like first data file .0, the next .1, etc. The first file mongod allocates is 64 megabytes, the next 128 megabytes, and so on, up to 2 ...
0
votes
2answers
60 views

How to insert or update using single query?

I have a table test having columns id which primary key and auto incremented and name. I want to insert a new record if annd only if there are no records.For example input is id=30122 and name =john ...
-1
votes
1answer
35 views

converting mysql datebase

I have a question about converting mysql databases, I doing now new site, and want to use my old database, which is in latin_swedish_1 colacolation I want to convert this old database into ...
0
votes
0answers
7 views

Database systems with users and sub users accessing the data

I am making a database for school student maintenance. Below is the basic description. There are schools. One school has many staff (i.e: Principles,Teachers, Section Head, Office Staff etc) These ...
1
vote
2answers
92 views

SQL Server - Slow Database for no apparent reason [on hold]

I have a DB Server running SQL Server 2008 R2 SP2 on 24 physical Cores and 32GB of RAM. The database files are on a SSD Raid1 and the TempDB on a SAS 15k (150GB DB) I assume that the server has more ...
0
votes
1answer
28 views

Help with MySQL my.cnf config

So I'm running MySQL on a high availability cluster with the MySQL data directory on a GlusterFS. I want to: - Disable the query cache (--query-cache-size=0) - Switch on external locking ...
0
votes
2answers
33 views

PostgreSQL: Use column with hash based on other columns as unique index?

My previous problem is still not fixed: We cannot set a unique index because NULL values are allowed... we use this table in our database: CREATE TABLE offer ( offer_id serial PRIMARY KEY , ...
0
votes
1answer
22 views

Daisy chaining two is-a relationships?

I'm currently dabbling in ER modeling and wondering if it is possible to create a chain of is-a relationships. Example: Here I'm basically trying to model specific in-stock items available for rent ...
3
votes
1answer
51 views

what does !! as an operator in mysql?

I tried to use the exclamation mark as a not operator in a query SELECT !0, !!0, !!!0, !1, !!1, !!!1, !2, !!2, !!!2; | !0 | !!0 | !!!0 | !1 | !!1 | !!!1 | !2 | !!2 | !!!2 | ...
0
votes
1answer
45 views

Transpose MySQL rows as column names - DYNAMIC

My goal is to be able to calculate the time difference between the ticket timestamp being created and closed and if reopened Add time from being reopened to closed again etc.. I have an existing mySQL ...
0
votes
1answer
52 views

Not receiving archivelogs from production to remote side

I have a scenario in which we have Designed data guard. Where we have 2 standby sides. One standby is located locally and 2nd standby is located on remote side. The distance between local and remote ...
5
votes
4answers
1k views

Datawarehouse bad practice?

In our Datawarehouse context, we have to update some record in fact tables inside our ETL. One thing we did is to create nonclustered indexes just before the heaviest queries, and drop them ...
0
votes
0answers
36 views

Is there any free, usable PostgreSQL formatter on Windows? [closed]

We're using pgAdmin3 and Notepad++ and we need some kind of a formatter that helps us format the old code we took from the lazy programmers. What I tried so far and didn't work: Poor Man's TSQL ...
1
vote
1answer
11 views

Mariadb refusing to read values on the my.cnf file

today i was optimizing my mariadb since my website was running too slow My machine is a Centos 7 , 4 gbs ram 3 cpu i runned a script called mysql_tuner.pl and the results were: -- MYSQL ...
1
vote
2answers
37 views

How AlwaysOn Availability Group secondary replica catches up with primary after secondary server long downtime

Can someone point me to the MS article or blog post that explains in details how AlwaysOn Availability Group secondary replica catches up with primary after secondary server long downtime? I did ...
0
votes
1answer
61 views

how to convert inner join to where clause [on hold]

I have a sql query to retrieve a data from a complex database. Following is the sql query, select * from A a inner join B b on a.a_id = b.a_id inner join C c on c.b_id = b.b_.id inner ...
1
vote
1answer
28 views

mongo: how should I layout my data

I have 2TB of data currently spread across many CSV files that looks like: { 'rec_date': "2010-01-29", 'rec_time': "09:15:00", 'site_no': '46', 'data_owner': '1', 'flow_period': '5', ...
1
vote
2answers
51 views

T-SQL — Why do ALTER and UPDATE statement only run when separated into their own batch?

I have update and alter statements that are only running when they are put into they're own batch. Below is my shortened version. It'd probably be a good idea to skip the code and read my question ...
2
votes
1answer
56 views

SQL Server service account Windows privileges and rights

My question is, if you create a new domain user account for each of the SQL Server processes, what permissions should be set for each account? Or does the SQL configuration manager actually take care ...
0
votes
1answer
22 views

how to query multiple counts on related tables

For each Forum, there are many Posts, and for each Post, there are many Comments I'm trying to query the total number of Posts and Comments for each Forum So I'm looking to have an output as such: ...
1
vote
1answer
25 views

Is there a way to query all error messages in Postgres?

Postgres has a catalogue of possible error messages here: http://www.postgresql.org/docs/8.2/static/errcodes-appendix.html#ERRCODES-TABLE However, I would like to query this information from a ...
0
votes
1answer
30 views

how to get child categorys based on categoryid

this is my table structure i need to find child categoryids. If CategoryID 1 then 1,2,3,4,10,12,13,14,15,16 when CategoryID 2 then 2,10,12,13,14,15,16
1
vote
2answers
58 views

MySQL to SQL Server - Unixtime being major problem

I'm trying to convert this query to SQL Server. It already has a lot of updates. Still, I don't know what to do from here ( i'm not the best when it comes to programming in MySQL ) SELECT ...
3
votes
0answers
37 views

SQL Server Management Studio 2014 Backup - Set Property Devices Error

I recently upgraded my local SQL Server to Version 2014, which also installed the SSMS 2014. When using SQL Server Management Studio 2014 to create a backup (both local and remote, Server Versions ...
0
votes
0answers
32 views

Unable to sort this table for the specified condition in SQLite

I have this table given below with the following details. I am trying to sort this table on a specific way. Here's a sample screen shot of the table. Following is the table structure: Table ...
0
votes
1answer
12 views

Failing to automatically re-connect to New PRIMARY after a replica set failover , from Mongoose (MongoDB, NodeJS Driver)

I made a simple NodeJS App, with Mongoose as MongoDB Driver. And connected to a mongodb replica set. The App is working fine until I shut down the current primary, When the PRIMARY is down, the ...
1
vote
2answers
40 views

Return the id after insert or select

I want to build a function which will insert an email if the email value doesn't exist in the table and return the email_id of the row. How can I do this? Also how can I return the id if the email was ...
7
votes
2answers
431 views

ROLLBACK doesn't work after INSERT INTO newly created destination table

I am working on PHP-script which imports CSV file (customers.csv) into MySQL table (customers). Before inserting contents of CSV-file into the mysql table I am first backing up the original customers ...
0
votes
1answer
27 views

Mysqli prepare error: Unknown storage engine 'InnoDB'

I'm getting this error on my XenForo installation. Server logs show out of memory because of too many php processes opened up which cause mysqld to shutdown. The WordPress installation associated with ...
1
vote
1answer
87 views

SQL Server: grant select access to a user in a view and not in its tables

I have a SQL Server 2012 instance with a few databases. In one of them I created a view, that selects tables in more than a database. I want a user to be able to select that view, but it must not ...
0
votes
1answer
26 views

How to reference categories table in products table?

I am using modified preorder traversal algorithm to store product categories in database (like image shown above). But i don't understand how to reference it in my products table. Here is my ...
1
vote
0answers
11 views

Custom cycling order in MySQL

Having following Foo table: id | name | group ===|=========|====== 1 | "John" | 1 2 | "Paul" | 1 3 | "Marry" | 1 4 | "Josh" | 1 5 | "Mike" | 2 6 | "Kevin" | 2 7 | "Ramon" | 2 8 | "Kim" ...
0
votes
1answer
57 views

How to make a single row result query to return multiple rows

I have the following WITH SQL Query which does select a set of filling stations along a route within the distance of 1000m. To have the measurement in meter I cast the geometries to geography. I also ...
0
votes
1answer
23 views

How bigger page size effect at performance?

I know in case of Cluster index bigger page size improve peformance for range and multipoint query. Does bigger page size can effect to degrade performance when we have non cluster index .Because ...
1
vote
1answer
48 views

Join conditions and Where conditions in Left Join

STUDENT table contains a list of students in my school Database LIBRARY_BOOK table contains the information of each Book that is with currently with any student. each student is allowed only 1 book ...
2
votes
0answers
38 views

How to identify whether a log backup or job executing a SP is causing High Page Reads/sec

For one of my servers( SQL server 2008R2) we can continuously witness High Page Reads/sec during business hours say: from 7 AM to 9 PM EST. I kept the counter settings to monitor the same and found ...
1
vote
0answers
44 views

Oracle instead of trigger update performance issue

I have a large table containing over 15million records with 4 columns that form a compound key. Because we use a development environment that doesn't support compound keys I was required to create a ...
0
votes
0answers
12 views

MySQL View: Transform rows in columns and update

i would like to show data from this mysql-table: ID | Channel_ID | Value | Time | 01 | 15 | 10,5 | 364 | 02 | 3 | 4,2 | 365 | 03 | 3 | 5,3 | 394 | in an ...
-2
votes
1answer
42 views

SQL: how to scan an entire table sequentially from top to bottom

How do I 'scan' all the way through an SQL table (approx 120k rows/50 columns) from the top/beginning, all the way to the bottom/end, and for each row found, I will need to 'do something'. The 'do ...
0
votes
0answers
10 views

How I do a complete backup restore of MySQL Schema with views and functions?

I am trying to backup a single schema on a Windows server and restore it to an Ubuntu 12.04 Linux server running MySQL 5.5.4. The schema includes views and functions. When I used the MySQL Workbench ...
1
vote
2answers
48 views

Query data before a commit transaction

My understanding is that, in a MS SQL Server Management Studio window, after doing a "begin transaction" and then making some changes like add data to a table , you can only query that table and those ...
1
vote
1answer
43 views

What is {Oracle}… {Oracle Off}?

I inherited an old script, that should, as part of a pl/sql routine, create a temporary index for me. I tried it on Oracle 11.2.0.4.0, but it does not accept the options. CREATE INDEX x ON y(gid) {IN ...
-1
votes
0answers
41 views

Surrogate column as part of composite key [closed]

Let's say we have TABLE with columns (A, B, C, D, E, K). K is the key of (A, B, C). Both (A, B, C, D) and (K, D) are unique keys of TABLE. I need to join two TABLEs like this (we need to return A, ...
0
votes
1answer
26 views

Modifying a result set in a Stored Procedure, then returning that modified set

I am currently in the process of designing my database for a mobile/web application. When I look at competing apps I see a massive flaw in how they handle user locations. Due to the nature of the ...

15 30 50 per page