2018-10-22         Benson

How Do I retrieve the content of a database into more than one model in MVC5?

I would appreciate your assistance on this challenge i'm having with retrieving the content of a database into more than one model. Three columns needed (InsBranchNo, PercentageCover and Leadcode) are available in Underwriting_InsurerPolicyDistribution table. However, Account_ClientReceiptDistribution needs the content of these 3 columns for calculation. How do I pass the content of the 1st to the second for a particular Id using the Foreach Loop.While retrieving the data from the database for a particular ID, below is how I loaded the rows involved into the Model.Underwr...

 database                     1 answers                     43 view
 2018-10-22         Cedric

Web Application - send request to server every time or update database frequently?

I'm developing a web application that makes it easier to visualize and plan schedules at my university, as the current portal website displays the class data in a not helpful way. The user puts in the classes they need, and the application will generate different possible schedules for you.There is a public web page I've found that you can do class search on and that I can send HTTP requests to to get back class times, and I plan on using this to get the data for my application.I would like the data the end users sees to be accurate and up-to-date, since during registration...

 database                     1 answers                     40 view
 2018-10-22         Parker

Custom shop database structure

I have my custom CMS system with simple shop module. Now I want to integrate new features as product variants, sizes and color. What's the best database structure for this? Now my product tables looks like:products - product informationsproducts_lang - all product's strings for translationproducts_categories - available categoriesproducts_categories_pivot - pivot table for categoriesproducts_similar_pivot - similar pivot tableI would like to solve issue when shop has for example running shoes model. What's the best approach? Create separate products for each shoes color? Or...

 database                     1 answers                     92 view
 2018-10-22         Stacey

craigslist’s / kijiji's schema

I'm curious to find out what kind of database schema craigslist and kijiji uses. They have many categories and cities that grow all the time. The levels also get deeper sometimes (sub-categories, and areas/neighborhoods). The part I don't understand the most is how they manage their categories. What is the database structure behind their setup? They have so many categories and sub-categories, let's say somebody posts an item inside Cars -> Parts & Accessories > Racing PartsA few days later, people request more sub-categories under "Racing Parts":* Accessories* Auto Raci...

 database                     1 answers                     100 view
 2018-10-22         Hedda

How much compound index is slower than single index

I'm thinking about removing index (A) and create compound index (A,B), because A and B are often use together in where clause.However I wonder how will it impact query if only A will be requested in where clause.Do you know how could it behave on different databases?(index is created using default type on for example 10million record tables) The best way to find out is to actually do it :)So I created a table:CREATE TABLE TestTable (ID INT,FirstName VARCHAR(50),LastName VARCHAR(50),City VARCHAR(50))Then inserted 100 xxx rows:INSERT INTO TestTable (ID,FirstName,LastName,C...

 database                     1 answers                     27 view
 2018-10-22         Ward

Codeigniter database make case sensitive

I need to consider case sensitivity when login to my system. But password do not consider case. $this->db->select('user.*,userprofile.*,user.id as uid'); $this->db->from('user'); $this->db->join('userprofile', 'userprofile.id = user.id'); $this->db->like('email', $udata['email']); $this->db->like('password', $udata["password"]); $query = $this->db->get();The above is my query. How can I change it so that its case sensitive? a possible approach could be$this->db ->select('user.*,userprofile.*,user.id as uid')...

 database                     2 answers                     18 view
 2018-10-22         Marico

Compilation error when creating statement level trigger

I'm trying to use a statement level trigger, not a row-level trigger. I can't for the life of me figure out how to get this trigger working without compilation errors. Anything super obvious I'm doing wrong? I've tested the select statement to find the count and it works fine.CREATE OR REPLACE TRIGGER bustaxiAFTER INSERT ON BUSDECLARE var_count NUMBER;BEGIN var_count := (SELECT COUNT(L#) FROM (SELECT L# FROM BUS INTERSECT SELECT L# FROM TAXI)); IF (var_count > 0) THEN RAISE_APPLICATION_ERROR(-29500, 'Already drives a taxi!'); END IF;END;/ I managed to get it ...

 database                     1 answers                     61 view
 2018-10-22         Dempsey

Drupal 7 database API error "You have an error in your SQL syntax"

Using the following code: db_update('nodesequence_nodes') ->fields(array( 'order' => 1, )) ->condition('nid', 1, '=') ->condition('nsid', 1, '=') ->execute();I get the following error: PDOException: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'order='1' WHERE (nid = '1') AND (nsid = '1')' at line 1: UPDATE {nodesequence_nodes} SET order=:db_update_placeholder_0 WHERE (nid = :db_condition_placeholder...

 database                     1 answers                     45 view
 2018-10-22         Lindsay

Drupal 7 Single Sign on using settings.php

Hey guys, was just wondering how I would go about setting up my Single Sign on with no modules in Drupal 7. I had it running in Drupal 6 but some things were changed in the settings.php file and I'm having a hard time figuring this out. You can also use a reference to a schema/database as a prefix. This maybe * useful if your Drupal installation exists in a schema that is not the default * or you want to access several databases from the same code base at the same * time. * Example: * @code * 'prefix' => array( * 'default' => 'main.', * 'users' => 'shared.'...

 database                     4 answers                     66 view
 2018-10-22         Lisa

SQL Search for row when 2 column in same row equal 2 values

let's supose I have this table in my db:----------------------------------| userID | meta | value ||--------------------------------|| 1 | age | 20 || 1 | gender | M || 1 | country | Brazil || 2 | age | 21 || 3 | age | 22 || 3 | gender | F || 3 | country | Brazil |----------------------------------And I want to get all userID that are from Brazil and the age is more than 18 years... I tried something similar to this:SELECT distinct(userID)FROM tableWHERE (meta ...

 database                     2 answers                     31 view
 2018-10-22         Mick

Mirror table vs materialized view

From this excellent video "Microservices Evolution: How to break your monolithic database by Edson Yanaga" I know that there are different ways to split chunk of data as separate db for microservice:ViewMaterialized ViewMirror Table using TriggerMirror Table using Transactional CodeMirror Table using ETL toolsEvent SourcingCould you please explain me the difference between mirrored table and materialized view?I'm confused due to both of them are stored on disk... My understanding is :-Mirrored tables Mirrored tables are generally an exact copy of the another, source tabl...

 database                     1 answers                     12 view
 2018-10-22         Woodrow

Sqlalchemy best practice for creating and naming sql tables based on new table creations

As the title suggests I need help understanding how to link new tables to an existing sqlalchemy class, if that's even the proper understanding.dbstring = 'sqlite:///db.db'engine = create_engine(dbstring)Session = sessionmaker(bind=engine)session = Session()Base = declarative_base()metadata = MetaDataclass SomeTable(Base): __tablename__ = 'somename' table_id = Column(Integer, primary_key=True) value_a = Column(Float()) value_b = Column(String()) value_c = Column(Float())I'd like to use the class as a way to control values inserted into future tables. Is there...

 database                     1 answers                     42 view
 2018-10-22         Hazel

Understanding natural join in Relational algebra

I have seen that natural join is just combination of selection and cartesian product but in various websites its said to be as combination of projection and cartesian product and both are completely different so which definition should corresponds to it more exactly? There are many different versions of "relational algebra" that differ even in their notion of "relation". There's no one PRODUCT or NATURAL JOIN.Some versions of the relational algebra have relation headings that are lists of attribute names. PRODUCT outputs an attribute for every input list element. If the...

 database                     1 answers                     14 view
 2018-10-22         Stanford

Relational Algebra expression for-

I know this question is already asked here.But it's not answered properly there.Consider the following relational database schemes:COURSES(Cno.name)PRE-REQ(Cno, pre-Cno)COMPLETED(student_no, Cno) COURSES gives the number and name of all the available courses.PRE-REQ gives the information about which courses are pre-requisites for a given course.COMPLETED indicates what courses have been completed by students Express the following using relational algebra: List all the courses for which a student with student_no 2310 has completed all the pre-requisites.MY ATTEMPT-S ...

 database                     1 answers                     14 view
 2018-10-22         Scott

Bad state: PostgreSQLSeverity.error : Specified parameter types do not match column parameter types in query SELECT to_regclass(@tableName:text)

I was following the Aqueduct (dart's web service framework) tutorial (https://aqueduct.io/docs/tut/executing-queries/) and then when i tried to run this command aqueduct db upgrade --connect postgres://heroes_user:password@localhost:5432/heroesi got an error:PostgreSQL connecting, heroes_user@localhost:5432/heroes.*** Uncaught error Bad state: PostgreSQLSeverity.error : Specified parameter types do not match column parameter types in query SELECT to_regclass(@tableName:text) **** Stacktrace * #0 __TransactionProxy&Object&_PostgreSQLExecutionContextMixin._...

 database                     1 answers                     31 view
 2018-10-22         Gabrielle

How do I use Laravel Eloquent to query an object based on an attribute/accessor condition?

Working with the examples from the documentation, if I have a accessor attribute like this:public function getFullNameAttribute(){ return "{$this->first_name} {$this->last_name}"; // both are real columns}How can I run a where based on a computed value? Something like:$user = User::where('full_name', 'John Doe');It should match items where first_name is John and last_name is Doe.Is there a way to do this or am I doing it wrong?Update: I found a similar question asked for Laravel 4 and it has an answer, however it states that the filtering is applied after the query...

 database                     2 answers                     48 view

Page 1 of 327  |  Show More Pages:  Top Prev Next Last