In an application which embeds SQLite3 and uses an in-memory database, is it possible to replicate the database between two running instances of the application? I could do this by hand with a homebrew protocol duplicating all my DB accesses, but it seems like something that should be done inside the DB layer…
Tag: sql
MySql – Way to update portion of a string?
I’m looking for a way to update just a portion of a string via MySQL query. For example, if I have 10 records all containing ‘string’ as part of the field value (i.e., ‘something/string’, ‘…
Database design, which table has the foreign key
I have an Table USER (USER_ID, PASSWORD, NAME, …) and an Table ACCESS_ROLES for the Users, every user can have one ACCESS_ROLE (ONE-TO-ONE). Which table has the Foreign Key? I would put the USER_ID into ACCESS_ROLES table. Is there any best practice approach? Answer Since you will be having a one-to-one…
What’s wrong with my SQL query?
I need a quick look at my SQL query. It’s already given me a headache. Comparing some advice I have gotten, I could not figure out the proper format for my SQL. This is my code: Thanks in advance! EDIT: Currently I have this as the form: This is the insert query: Seems to submit the entry, but not the
Force index use in Oracle
I encountered this question in an interview and had no clue how to answer: There is a table which has a index on a column, and you query: The query takes too long, and you find out that the index is not being used. If you think the performance of the query will be better using the index, how could
Displaying the constraints in a table
Hello I am trying to display the constraints in one of my tables but for some reason I get the message no rows selected. Noted below is the table I have created. This is the code I am using to show my constraints. I am a rookie so I want to make sure I understand what is wrong. I have
Use a LIKE statement on SQL Server XML Datatype
If you have a varchar field you can easily do SELECT * FROM TABLE WHERE ColumnA LIKE ‘%Test%’ to see if that column contains a certain string. How do you do that for XML Type? I have the following …
Strategy for avoiding a common sql development error (misleading result on join bug)
Sometimes when i’m writing moderately complex SELECT statements with a few JOINs, wrong key columns are sometimes used in the JOIN statement that still return valid-looking results. Because the auto …
Check if Stored procedures have syntax errors
I have tons of stored procedures in my database. We are constantly changing the data structure (we are in development) Is there a tool that will tell me which stored procedures won’t compile? When …
sort the “rollup” in group by
I found that the “with rollup” option used with group by is very useful. But it does not behave with “order by” clause. Is there any way to order by the way I want as well as calculate the sub-totals? …