Skip to content

Tag: database

Copy data on parent and child table

I have two database tables. What I need to do is to copy specific data from one storage to another, but also keep the mapping to the photos. First part I can do easily writing but after that newly inserted items does not have photos. Note, that document_id field is unique for not copied items. Answer Assuming id columns are

Update Multiple Values in a SQL query based on row values

Is there a possible way only use SQL Update query to update July Data to August data? E.g. The Value of B in July should be updated to 12. Dimension Key is the primary key and Name is the “durable” key. CURSOR is allowed to use but not preferred. Answer You must join the table to itself to set different

Restrict “subcategory” based on other “category” column

I’m creating a SQLite database where I have 3 tables: transactions, categories, sub-categories in the transactions table, there is a column “category” with a foreign key to the categories table in the sub-categories table, there is column “parent-category” with a foreign key to the categories table Now, how can I ensure that the sub-category that I fill in with transactions

What do you call the . syntax in SQL?

In many databases, when writing a SELECT query, you can provide the database name along with the table name in order to resolve any ambiguity the database might encounter in case there are multiple databases with the same table names. For example, let’s say the user currently logged into SQL Server has SELECT privileges on databases DB1 and DB2, and

Create a new double-field based on the existing string-filed

There is an SQL query forming a table. It is necessary to form another double-number field based on one of the string fields in the table. Values of the original string field (BRLOADSTA0): Values of the resulting double-field (BRLOADSTA9): The request which I’ve create: Full snippet: Thanks in advance even for trying to help 🙂 Answer Could you tell us

Update query with join and where clause

I’m currently confused with a (fairly easy) update statement that I’m trying to execute on a table. The two tables are as such: Customer table has the columns Loan table has the columns I would like to update the passworddisabled attribute to true if they are registered via a specific cash register. I’ve made use of the distinct command because