Categories
Mastering Development

How do I solve this error caused from a Pivot?

When trying to pivot my table – a dynamic one which I can’t define as entries my change can be added or deleted – I receive a fatal error. I used a checked answer from this question and changed it where it was necessary. You will see that I use AVG instead of SUM. SET […]

Categories
Database Development

How to “cascade delete” children without deleting parent?

I have a table, let’s call it parent: CREATE TABLE parent ( id TEXT PRIMARY KEY, name TEXT, description TEXT, — other parent attributes created_at TIMESTAMPTZ DEFAULT NOW() NOT NULL, updated_at TIMESTAMPTZ DEFAULT NOW() NOT NULL ); It has a number of child tables, let’s say child_1, child_2, … child_n. They all look something like: […]

Categories
Development

Rails model does not load properly

I updated my Rails application to a newer version of Rails, and now one of my models is unusable, as if it was loaded empty, as if Rails was not aware of its structure and how to populate it. This model is Task and is based on Single Table Inheritance: class Activity < ActiveRecord::Base (…) […]

Categories
Development

LEFT OUTER JOIN Postgresql

I have table invoice_items : CREATE TABLE invoice_items ( “id” varchar, “invoice_id” varchar, “type” varchar, “current_balance” numeric(19) default 0, “record_id” integer, “created_date” timestamp, “trx” integer, “external_key” varchar, “tenant_record_id” bigint ); then table invoice : create table invoice ( id_invoice bigint, uid_invoice varchar(50), datetime timestamp, description text, amount integer, eeuser bigint, external_key varchar(30), tenant “char”, trx […]

Categories
Development

LEFT OUTER JOIN Postgresql

I have table invoice_items : CREATE TABLE invoice_items ( “id” varchar, “invoice_id” varchar, “type” varchar, “current_balance” numeric(19) default 0, “record_id” integer, “created_date” timestamp, “trx” integer, “external_key” varchar, “tenant_record_id” bigint ); then table invoice : create table invoice ( id_invoice bigint, uid_invoice varchar(50), datetime timestamp, description text, amount integer, eeuser bigint, external_key varchar(30), tenant “char”, trx […]

Categories
Development

Using multiple tables in SQLite

I am using two tables for my application. tbl_users and tbl_tasks, I can access tbl_users without any problem, but when I use tbl_tasks it keeps on crashing the app. The contents are both the same in the two functions, just the table_name is different. DatabaseHelper.java public class DatabaseHelper extends SQLiteOpenHelper { public static final String […]

Categories
Development

Getting error when trying get values from sqlite table

I’m using SQLite and is trying get some values from the Database. I have 2 tables in the database. A database called FOOD and one called DRINK. The problem that occurs happens in the FOOD table. I can the erorr message: no such table: FOOD. Which I don’t understand as the the tables and the […]

Categories
Development Kotlin SQL

I am using sqlite incorrectly in this kotlin class

I started learning kotlin recently, and I am trying to implement a database using SQLite. When I try using the functions the app crashes. I don’t know how to find the error log so I have added the functions I made and where the functions are implemented. Thank you for your help. package com.example.mrtayyab.sqlitedbkotlin import […]

Categories
Development

In Android Studio : Show fragments which have RecyclerView in Tablayout

I have project about Categories of Foods and lot of Food inside the one category . First: I want to create a local Database with two tables (Category , Items) and add data in it . Seconed: I have Tablayout, I’ll get his names from the Category table. Third : The Viewpager will have Fragment. […]

Categories
Development

How to create a large number of tables

I’ve got a large dataset to work with to create a storage system to monitor movement in a store. There’s over like 300 products in that store and the main structure of all tables is the same. The only difference is the data inside. There’s a larger data base called StorageTF and I want to […]