Two components Data Definition Language (DDL): create ... · •Data Definition Language (DDL):...

Post on 19-Aug-2020

13 views 0 download

Transcript of Two components Data Definition Language (DDL): create ... · •Data Definition Language (DDL):...

• Two components

• Data Definition Language (DDL):

• create table, etc.

• Data Manipulation Language (DML):

• select, insert, delete, update, etc.

Intro to SQL

The basic “SELECT” statement:

Select A1, A2,......AN From R1, R2,.......RN

Where condition

The basic “SELECT” statement:

Select A1, A2,......AN From R1, R2,.......RN

Where condition

3

21

The basic “SELECT” statement:

Select A1, A2,......AN From R1, R2,.......RN

Where condition

3

21

what to returnrelationscombine/filter

SELECT s.ra, s.dec, s.psfmag_g-s.extinction_g as g, s.psfmag_r-s.extinction_r as r, s.psfmag_i-s.extinction_i as i, pm.pmra, pm.pmdec, pm.pmraerr, pm.pmdecerr

FROM star as s JOIN propermotions as pm ON s.objid = pm.objid

WHERE s.ra BETWEEN 225.6 AND 225.8 and s.dec BETWEEN -2.0 and -1.8 AND CLEAN=1 AND s.psfmag_r <22

The basic “SELECT” statement:

Load query into DR9 servershow SELECT count(*)

show check syntax and retrieval optionsshow clean photometry query

Flags & Bitmasks

One thing that's important to fully exploit the SDSS database is a good understanding of bitmasks.

A bitmask uses the bits in an integer as "toggles" to indicate whether certain conditions are met.

http://www.sdss3.org/dr10/algorithms/bitmasks.php

Binary, decimal, hexadecimal....

What??

https://www.youtube.com/watch?v=TFY8YuBLNKc

Go back to bitmasks page and showsearch with flags again.

Mag

nitu

de

Sun

10Msun

Color/Temperature

0.1Msun

CMD = Color-Magnitude Diagram (Color vs. Mag)

HR = Herzberg-Russell Diagram (Temp vs. Luminosity)

Science Interlude: Stellar Evolution

When stars form there are a small number of high mass stars, and a large number of low mass stars.

Main Sequence

and CMDs

Magnitudes, Luminosity and Fluxes

An astronomical source gives off a certain number of photons (per second per wavelength) which we will call its luminosity, L.

F =L

4�d2

The flux we measure from a source depends on its distance:

In the radio, fluxes are typically measured in Janskys, where:

1 Jansky = 10-26 watts / square meter / Hertz

Optical and infrared astronomers quantify the brightness of an object using the magnitude system, which is the proportional to the logarithm of flux.

Magnitudes are define as: m = 2.5 * log10(F) + 2.5*log10(F0)

where 2.5*log10(F0) depends on the photometric system.

The star Sirius has an apparent magnitude mV = V = -1.4

The faintest stars observed with HST have apparent magnitudes V ~ 30.

Color

Mag

nitude

The Magnitude System

Colors are defined as the ratio of fluxes, equivalently, the difference between magnitudes, e.g., V - I

Dotter et al. (2011)

The Magnitude System

In addition to the UBVRI photometric system, the SDSS system is also widely used (ugriz):

It is possible to transform between photometric systems.

Apparent versus Absolute Magnitude

The observed flux of an object depends on its distance from us (F = L / 4*pi*d2).

Thus, when we observe an object, we are measuring its apparent magnitude (mv or V, mg or g)

The absolute magnitude of an object (MV, Mg, etc.) is related to its total luminosity.

Absolute magnitude is defined to be M = m when an object is placed at 10 parsecs (10 pc).

In PS#2, you will show that: M = m + 5 + 5*log10(d) where d is distance in units of parsecs

Science Interlude: Stellar Evolution

Stars form out of clouds of gas.

Out of a single gas cloud, many stars are born at a single time:

-> lots of small mass stars -> handful of massive stars

Stellar birth is clustered.

05.03.2007 Mürren - Saas-Fee-Course - E.K. Grebel 31

2MASSinfrared image

Magellanic Clouds

Sagittarius

bulge

disk

halo

Can we find traces of such events

in our Local Group?

Milky Way

Sun

8 kpc

~200 kpchalo

GC’s

25 kpc

1kpc = 3 x 10^19 m ~ 3300 ly

open clusters

Science Interlude: Color Magnitude Diagrams

The Pleiadesseveral 1000 stars

M80~million stars

100 million years oldChemical abundance similar to Sun.Significant binary star fraction

12 Billion years oldChemical abundance similar to early universe

Science Interlude: Color Magnitude Diagrams

M13

Mas

s

Sun

10Msun

Temperature

0.1Msun

Stellar Evolution

Lowest mass star 0.08Msun,

limit for nuclear burning.

Highest mass star ~100Msun,

limit for fragmentation?

Main Sequence

Out of a single gas cloud, many stars are born at a single time:

-> lots of small mass stars -> handful of massive stars

Stellar Evolution

gravity pulls in

pressure pushes out

While a star is on the main sequence, it is in equilibrium.

Gravity balances pressure.

Pressure comes from heat generated by nuclearfusion in star’s core.

More massive stars therefore must have a higher pressure/temperature in their core, in order to maintain equilibrium.

The Sun’s Lifetime

Sun is born Now White dwarf formsSun runs out

of hydrogen fuel

The Sun formed 4 billion years ago, and will live for another 4 billion years.

The Sun’s Lifetime

At very end of evolution, outer region expands and disappears.

Inner region shrinks,white dwarf left behind.

white dwarf

Stars are ~black bodies, i.e., in thermal equilibrium.The radiation has a specific spectrum and intensity that depends only on the temperature of the body.

Stellar Evolution

L �M3.5

Stellar Evolution

More massive stars must have a higher temperature to maintain equilibrium.

Stars are approximately black-bodies, thushotter stars are also bluer.

L � T 4

Along the main sequence, temperature, T, and luminosity, L, are related:

Stellar Evolution - Lifetimes

How does stellar mass relate to a star’s lifetime?

The total energy released by a star in its lifetime is, Etotal: Etotal = L * time

Nuclear fusion is turning mass into energy, which means Etotal = eff * M c2

t �M�2.5

Using the relationship between L and M on the main sequence:

Massive star lifetimes are much shorter than lower mass stars.

Stellar EvolutionM

agni

tude

/Mas

s

Sun

10Msun

Color/Temperature

0.1Msun

10-100 million years(very short lifetime)

2-8 billion years

10-100 billion years(longer than age of Universe)

Stellar EvolutionM

agni

tude

/Mas

s

Sun

10Msun

Color/Temperature

0.1Msun

How does Sun’s post-mainsequence evolution appearin color-magnitude space?

Stellar Evolution

Composite CMD for open star clusters in the Milky Way

If stars of all masses form at same time, can determine ageby noting which stars are justevolving off of the main sequence.

100 million years oldChemical abundance similar to Sun.Significant binary star fraction

12 Billion years oldChemical abundance similar to early universe

Science Interlude: Color Magnitude Diagrams

MS = main sequence MS

RGB = Red Giant Branch

HB = Horizontal Branch

WD = White Dwarfs