I want to deal with multicollinearity, but I m confused which column to drop - regression

How to deal with Nan columns? Which column to drop to avoid collinearity
I tried to check the co relation between features, before going ahead which feature I should drop to avoid multicollinearity ?

Related

MSQL alter table with JOIN

I am trying to update a table with a column from another table. I dont want to view the join, I want to alter the table.
However, this is faiing:
UPDATE
a_dataset
SET
a_dataset.lang_flag = b_dataset.language
FROM
a_dataset
INNER JOIN
b_dataset
ON
a_dataset.ID = b_dataset.ID
However, I keep getting a syntax error, and cannot locate what I am missing?
I am guessing that you mean to update your records when you say alter the table. If so, you can simply rewrite your update statement with join like this:
UPDATE a_dataset a
JOIN b_dataset b ON a.ID = b.ID
SET a.lang_flag = b.[LANGUAGE]
As Uueerdo and myself said: Starting table names with numbers is a bad[TM] idea. The same is for letters, which you now chose to use. a is no better than 1 in this regard. Also calling tables just "dataset" isn't really helpful either. What is the table storing? Users? Then call it users. Articles on a news web site? Then call it articles. And so on. Everything in a database is dataset, no need to tell that anyone.
I guess you're new to SQL, am I right? Because another issue is: Unless you're going to drop table b_dataset after this command, you're probably doing something you're not supposed to do in relational data bases. The whole idea is to store all data only once. If you can automagically copy the column from b to a, then you could also select join if from a and b when you need it instead of copying it.
For learning SQL (or anything else), Stack Overflow is probably a bad place (it's good for asking questions in the process, though), so I recommend that you go get someone who has some experience in SQL to teach you, or get some book / tutorial on SQL. From first glance, this seems to be a good on-line book: http://sql.learncodethehardway.org/ - but I didn't read it.

Creating a table with specific field parameters

I struggling to create a table that sets table parameters as well as creating the columns.
I am using MySQL server.
I require that the table meets the following criteria:
The table should be Called CUSTOMER with the columns CUST, LOCX, LOCY.
The column CUST will be a 1 up serial starting 1001 and will be the primary key.
LOCX and LOCY will contain X and Y Integers no greater than +-11, and will be foreign keys to other tables.
For info: I then intend to add my data to the table using the INSERT INTO function in a separate query that I already have.
Any direction on the construction of a query to create a table meeting the requirements above will be greatly appreciated
you can create a new table with a MySQL-GUI if you have problems with that.
These GUI-tools usually provide a New-Table button that also allows you to define your table without writing any code. They are often limited but should be more than sufficient for your needs. there are 1-month trial versions for paid versions and even completely free GUIs so you don't have to buy anything.
after that use the following code to retrieve "perfect" SQL from MySQL:
show create table your_schema_name.your_table_name
do that a few times and study the code. Soon you will be able to write create-table statements and include more complex column definitions on your own. It will also be easier to understand the MySQL Documentation which can be confusing and somehow intimidating with its completeness for beginners.

Adding a new record to a relationship in MySQL

I'm trying to learn more about creating "advanced" databases, so my project is to keep track of the wins and losses at a website called SaltyBet. Bots fight against each other and people bet on the outcome. I want to create a database for myself to keep track of each match, where I enter in the values manually.
I have 2 tables:
chars with just an "ID" field and a "name" (unique) field, and
matches with "ID", "player1", "player2", "winner", and "odds".
The way I want it to work is if I go to insert a row into matches, it will create the appropriate character in the chars database, if it doesn't already exist.
I have the following relationships set up within PHPMyAdmin:
Creating this form in the "Insert" view:
This works fine - as long as I have already entered in both characters in the chars table. However, there often isn't enough time to go through 3 different views to create the appropriate characters in the chars table to then use in the matches table. I had the idea to create a trigger, which inserts the characters if they don't exist, but AFAIK I cannot maintain the relationship between the two tables because I cannot enter a new one in matches.
Is there any way I can easily approach this without writing a form in PHP? I'd rather learn how to do it the "proper" way instead of relying on the simple MySQL commands I learned years ago and never expanded on.
Thank you!
I agree that if you want to use a trigger that creates the row in chars after an insert in matches, it won't work because the insert itself will give a problem.
I don't see how you can do it without coding an application that would first verify in chars whether the row exists, insert it if needed, then insert into matches.

What is the algorithm that you use to populate a Type-3 SCD?

A bit new here, but here goes. What is the algorithm that you use to populate a Type-3 SCD? I have fact tables and dimension tables setup already, and have done this already through TOS in talend, but need the code. Using MySQL. Any kind of general idea or even reference to the right way to go about this is appreciated. Also any documentation reference is also welcome.
Well i guess this is what you are looking for.
eg we have a salesperson dimension table and we need to change its territory using SCD Type-3
Step-1
Add Column using ALTER Table Statement
ALTER TABLE SalesPersonTable ADD old_territory datatype
old_territory is added`
Step-2
Rename previous Column territory to new_territory
ALTER TABLE SalesPersonTable CHANGE territory new_territory datatype
Step-3
Update the affected SalesPerson data
UPDATE SalesPersonTable SET old_territory = new_territory WHERE SalesPersonKey=YourKeyHere
Step-4
Update the new_territory now
UPDATE SalesPersonTable SET new_territory = 'New Territory' WHERE SalesPersonKey=YourKeyHere
Now you can see here that there is nothing like algorithm here. There are just simple steps to follow. you can write your own procedures to make this. Good Luck with That.

Manipulating data in a Microsoft Access table

I have a large database of client details, and I need to generate a totally new field of data based on a single other field. It would be a simple IF..THEN deal.
Example:
The source field has data that looks like this "BAR DIN" (Barrie Dinners) and I need to fill a new field with "Dinners".
From what I understand, Data Macros are the right way to do this, but I'd prefer not to buy Access 2010. There should be a way to do this with normal macros. This update only needs to be done once a year and can be done manually. I mostly looking for a way to avoid having to enter all that data manually for each customer.
Create a separate table to translate between the two:
source_field new_field
BAR DIN Barrie Dinners
FOO BROS Foo Brothers
Anytime you need to see the "new_field" values, JOIN that translation table to your original table (JOIN on source_field) to look them up. This approach is one of the fundamental reasons relational databases were created in the first place. This way your database will always be "up to date" without the need for any macros to populate a redundant field.