I need to create a star schema of table and apply on SSMS. To be simplier I focus on two tables:   One containing general informations about clients. Each client has a particular ID but can appear several times because he can be of multiple type.  One containing financial informations about them that are gathered every 3 months, each set of info about one client at a specific time will have an unique ID.   I set the client table as the parent table. I create it that way:   CREATE TABLE Customers ( CostumerID INT IDENTITY (1,1) PRIMARY KEY, Info 1 nvarchar,     Info 2 nvarchar,     Info 3 nvarchar )   I create the financial informations table this way:  CREATE TABLE FinInfo    (  FinInfoID INT IDENTITY (1,1) PRIMARY KEY,  CustomerID INT,  Date date,  Info1 INT,  Info2 INT,  CONSTRAINT FK_Customers FOREIGN KEY(CustomerID)  REFERENCES Customers(CustomerID)  ON DELETE CASCADE        ON UPDATE CASCADE     )   The thing is I don't know how to fill the costumerID in the FinInfo table without knowing it in the first hand.
Okay setting the scene. I have three tables, (Table1, Table2 and DataTable) and I want to insert into Table1 and Table2 using DataTable as source. So for every row in DataTable I want a row in Table1 and Table2, and Table2 needs to have the inserted id (PK) from Table1...  If I were to do this...  INSERT INTO Table1 SELECT A, B, C FROM MyTable INSERT INTO Table2 SELECT IDENTITY_INSERT(), D, E, F FROM MyTable   I'd get the ID of the last inserted record into Table1.  Is a CURSOR or WHILE loop the only ways to do this?
I have two tables in my database:  NEWS table with columns:   id - the news id  user - the user id of the author)   USERS table with columns:   id - the user id   I want to execute this SQL:   SELECT * FROM news JOIN users ON news.user = user.id    When I get the results in PHP I would like to get associative array and get column names by $row['column-name']. How do I get the news ID and the user ID, having the same column name? External monitors show blank screen until restart MacBook Pro (15-inch, 2016) with 2 USB-C to HDMI adapters. The setup works great if I start up in that configuration.   If I connect the adapters while the machine is running or simply sleeping, one of the monitors will never get a signal and stay in low power mode. The OS sees the monitor, it shows in the display arrangement settings and I can move the mouse into it, but until I restart, I can't see anything on it.  Once I have restarted I can let the machine sleep or whatever, and the display still works unless I disconnect the adapter. As soon as I do that a restart is required to use it again.   Using MacOS Sierra (10.12.4)  Using this adapter: In Harry Potter and the Goblet of Fire the Triwizard Cup was used as the portkey to send Harry and Cedric to the graveyard in Little Hangleton to face Voldemort.    Why was the Triwizard Cup chosen?    Couldn't Crouch Jr. have used anything as a portkey; which would have been much easier and without as much risk (after all of their planning Cedric almost ended up getting the cup first). I have an interest in contour integration. I am not that good at it, but I enjoy learning what I can about it.  Here is a version of a rational log integral rarely encountered.  $\displaystyle \int_{0}^{1}\frac{\ln(x^{2}+1)}{x+1}dx=\frac{3}{4}\ln^{2}(2)-\frac{{\pi}^{2}}{48}$  I can do this using real methods (via double integral and substitution). I can post my workings if anyone would be interested.  My question is, can this be evaluated using contour integration due to the limits being $[0,1]$ instead of $[0,\infty)$?.  Contours may not be the most efficient way to go about it, but what is the course of action when the limits are 0 to 1 instead of 0 to infinity?. The   echo one; echo two &gt; &gt;(cat); echo three;    command gives unexpected output.  I read this:  and many other articles about process substitution on the internet, but don't understand why it behaves this way.  Expected output:  one two three   Real output:  prompt$ echo one; echo two &gt; &gt;(cat); echo three; one three prompt$ two   Also, this two commands should be equivalent from my point of view, but they don't:  ##### first command - the pipe is used. prompt$ seq 1 5 | cat 1 2 3 4 5 ##### second command - the process substitution and redirection are used. prompt$ seq 1 5 &gt; &gt;(cat) prompt$ 1 2 3 4 5   Why I think, they should be the same? Because, both connects the seq output to the cat input through the anonymous pipe - .  Question: Why it behaves this way? Where is my error? The comprehensive answer is desired (with explanation of how the bash does it under the hood). What does "preceding" mean in Oracle? How to work out sqft/m of land coverage? I am currently self teaching myself on qgis whilst volenteering on a project on a river catchment and your help is hugely appreciated!  I need to be able to work out the percentage of land cover or sqft/m coverage. I have all the land uses on as a vector layer over my river catchment.   Many thanks and let me know what other info i need to give as a newbie! Cycles Emit Light from area on Texture So I have a giant object that is completely uv unwrapped. I would like to make areas of the object with a specific area of texture emit light.   The problem is that this object (and it is only one object) only has one material. I would like the lava to emit light, but I cannot move it to a separate material without breaking something.  I'd like to find a method where I can select a part of the texture and tell blender that whatever has that part of the texture emits light.  Is this possible?  Thanks. Prove that for $ 0&lt;x&lt; \pi $, $$ \quad S_n(x) = \sin x + \frac{ \sin3x }{3} + ... + \frac{ \sin((2n-1)x) }{2n-1} &gt;0 \quad \forall n = 1,2,... $$  Having trouble with this problem. This is an olympiad-style question, so an answer that doesn't use calculus or analysis would be preferred. A possible approach is induction, but for this we need to find a function in terms of $n$ and $x$ so that we can actually use the inductive step. If anyone has any ideas they would be appreciated.  If you really want to go down the calculus route (at this point I don't mind), then $ S_n' (x) = \cos x + \cos 3x + ... +\cos((2n-1)x) $ , which you can find a closed form for, but I don't know how useful that is. Can we move "Start a bounty" to a more intuitive location? Is there a GUI IDE for programming python just like java has netbeans?  I wanted one where we could drag &amp; drop test boxes &amp; labels just as we do in swing components using netbeans or eclipse.  Or is there an add-on present in either netbeans or eclipse itself? If in a UFD every maximal ideal is principal then it is a PID Why would someone buy a way out-of-the-money call option that's expiring soon? I swing trade equity options every once in a while for fun. This morning I witnessed something I do not understand at all.  In the attached photo, why would someone purchase 6 contracts for .05 at $76.  I just can't wrap my head around this!    Scenario:   Underlying Asset: RY.TSX  Current Price: $71.70 Days to expiry: 4 Days     EDIT: It happened again the next day with 74, see new table with headers as per request:   My only reason for asking is because RY.TSX is the Royal Bank of Canada, this stock will not move multiple dollars in 3 days(expiry in this scenario).  Why buy 10 @ 74 for .04 each instead of just buying 10 @73 for .04 which would have gone through.  If you do the math(excluding commissions): .04 * 100(shares in a contract) * 10 contracts = $40 Stock moves to 74 and they are in the money lets say for .20 .20*100*10 = $200  I just don't see the reward as 99% of the time you will lose this wager, it is just not worth it even if it does happen once in a blue moon.  I can think of much better things to do with $40.  For the skeptics another screen shot to actually confirm this order: I am trying to list all the files from dir1, dir2, dir3 and dir4 which might be anywhere in as a sub directory of my cwd using the find command. I tried the following with no success:  find . -type f -regextype posix-egrep -regex 'dir1/.+|dir2/.+|dir3/.+|dir4/.+'   I tried posix-extended as well. How can I list these files? How can I reset or revert a file to a specific revision? I have made some changes to a file which has been committed a few times as part of a group of files, but now want to reset/revert the changes on it back to a previous version.   I have done a git log along with a git diff to find the revision I need, but just have no idea how to get the file back to its former state in the past. Why does camera this tracking fail completely even when the solution value is very low? I have a CSV file where one line looks like this:  Duration, user, lat-start, long-start, lat-end, long-end 298, Casual,38.9101,-77.0444,38.91554,-77.03818   Each row in the CSV has two points and I need to draw a line between those two points for each row.   How can I do this using QGIS 1.8.0?   I have tried using the delimited text file plug-in, but it just draws points and has no line option from what I can see. I have a shape (rounded rectangle) in PowerPoint 2007 of which I would like to increase the vertical size only (to illustrate de-bottlenecking). So, the width will stay the same but the height will grow (both from the top and bottom, so the centre will remain in the same location).  Custom Animation -> Emphasis only appears to change the whole shape.  Is it possible to increase only the vertical size (stretch the shape)?  This is during animation of the shape. Render Glass like materials with Alpha Channel to composite in external app Hope you can help me with some issues I've been dealing these days.  As I'm rendering products, most of the time I need to render some transparent materials in order to do a post-pro in Photoshop, change the backgrounds, superpose images, etc.  I've been looking for an answer but yet I've couldn't get a solution for this problem.  I need to render materials with transparency and no background in Cycles.  I've found that there are two ways to do this:   Render with transparency in the materials.  Render and get two renders, the original and another one only with the alpha channel to edit in Photoshop.   For the first option, I've achieved to render a glass-like material, as PET plastic using this node tree:    For the second option, I haven't found a way to get the alpha channel in cycles that includes the object with transparency and, if possible, the shadows in the background| but without the background. In electrostatics, why the electric field inside a conductor is zero? In electromagnetism books, such as Griffiths or the like, when they talk about the properties of conductors in case of electrostatics they say that the electric field inside a conductor is zero.  I have 2 questions:    We know that conductors (metallic) have free electrons which randomly moves in all directions, so how come we can talk about electrostatics which by definition means stationary charges? When the textbooks try to show why the electric field inside a conductor is zero they say let us put our conductor in an electric field. What happens then is that there will be an induced surface charge density which consequently induces an electric field within the conductor such that the total electric field within the conductor will be zero. That is perfectly understood, but my problem is the following: the original claim was that the electric field within a conductor is 0, not the electric field after putting the conductor in an external electric field it became zero. I do not understand the logic!