Presentation is loading. Please wait.

Presentation is loading. Please wait.

SQL.

Similar presentations


Presentation on theme: "SQL."— Presentation transcript:

1 SQL

2 This is a database table called Elements
Atomic Number Symbol Name Atomic Mass Melting Point Boiling Point State Type 1 H Hydrogen 1.0 -259.1 -252.9 Gas Non-metal 2 He Helium 4.0 -272.2 -268.9 3 Li Lithium 7.0 180.5 1342 Solid Metal 4 Be Beryllium 9.0 1278 2970 5 B Boron 10.8 2079 2550 Metalloid 6 C Carbon 12.0 3367 4827 7 N Nitrogen 14.0 -209.9 -195.8 8 O Oxygen 16.0 -218.4 -183 9 F Fluorine 19.0 -219.8 -188.1 10 Ne Neon 20.2 -248 -248.7 11 Na Sodium 23.0 97.8 883 12 Mg Magnesium 24.3 649 1090 13 Al Aluminum 27.0 660 2467 14 Si Silicon 28.1 1410 2355 15 P Phosphorus 31.0 44.1 280 16 S Sulphur 32.1 112.8 444.7 17 Cl Chlorine 35.5 -101 -34.6 18 Ar Argon 39.9 -189.2 -185.7 19 K Potassium 39.1 63.25 760 20 Ca Calcium 40.1 839 1484 This is a database table called Elements Ans 1 a) 1 b) 1 c) 1 d) 1 e) How many records would be found if you used the query: a) SELECT Name from Elements WHERE Type=Metal b) SELECT * from Elements WHERE State=Gas c) SELECT Name from Elements WHERE Type=Metal AND State=Gas d) SELECT Name from Elements WHERE Atomic Mass>20 AND Type=Metal e) SELECT Name from Elements WHERE Atomic Mass<20 AND Atomic Number>5

3 This is a database table called Elements
Atomic Number Symbol Name Atomic Mass Melting Point Boiling Point State Type 1 H Hydrogen 1.0 -259.1 -252.9 Gas Non-metal 2 He Helium 4.0 -272.2 -268.9 3 Li Lithium 7.0 180.5 1342 Solid Metal 4 Be Beryllium 9.0 1278 2970 5 B Boron 10.8 2079 2550 Metalloid 6 C Carbon 12.0 3367 4827 7 N Nitrogen 14.0 -209.9 -195.8 8 O Oxygen 16.0 -218.4 -183 9 F Fluorine 19.0 -219.8 -188.1 10 Ne Neon 20.2 -248 -248.7 11 Na Sodium 23.0 97.8 883 12 Mg Magnesium 24.3 649 1090 13 Al Aluminum 27.0 660 2467 14 Si Silicon 28.1 1410 2355 15 P Phosphorus 31.0 44.1 280 16 S Sulphur 32.1 112.8 444.7 17 Cl Chlorine 35.5 -101 -34.6 18 Ar Argon 39.9 -189.2 -185.7 19 K Potassium 39.1 63.25 760 20 Ca Calcium 40.1 839 1484 This is a database table called Elements Ans 2 a) H; He; N; O; F; Ne; Cl; Ar 2 b) 2 c) 2 d) 2 e) 2. What would be listed if you used the query: a) SELECT Symbol from Elements WHERE State=Gas b) SELECT Symbol from Elements WHERE Type=Metalloid c) SELECT Symbol from Elements WHERE Melting Point>1000 d) SELECT Name from Elements WHERE Atomic Mass<10 AND Type=Metal e) SELECT Name from Elements WHERE Atomic Mass<20 AND State=Solid

4 This is a database table called Elements
Atomic Number Symbol Name Atomic Mass Melting Point Boiling Point State Type 1 H Hydrogen 1.0 -259.1 -252.9 Gas Non-metal 2 He Helium 4.0 -272.2 -268.9 3 Li Lithium 7.0 180.5 1342 Solid Metal 4 Be Beryllium 9.0 1278 2970 5 B Boron 10.8 2079 2550 Metalloid 6 C Carbon 12.0 3367 4827 7 N Nitrogen 14.0 -209.9 -195.8 8 O Oxygen 16.0 -218.4 -183 9 F Fluorine 19.0 -219.8 -188.1 10 Ne Neon 20.2 -248 -248.7 11 Na Sodium 23.0 97.8 883 12 Mg Magnesium 24.3 649 1090 13 Al Aluminum 27.0 660 2467 14 Si Silicon 28.1 1410 2355 15 P Phosphorus 31.0 44.1 280 16 S Sulphur 32.1 112.8 444.7 17 Cl Chlorine 35.5 -101 -34.6 18 Ar Argon 39.9 -189.2 -185.7 19 K Potassium 39.1 63.25 760 20 Ca Calcium 40.1 839 1484 This is a database table called Elements Ans 3 a) 1, Hydrogen;2, Helium 3 b) 3 c) 3 d) 3 e) 3. What would be listed if you used the query: a) SELECT Atomic Number, Name from Elements WHERE Atomic Mass < 7 b) SELECT Atomic Number, Symbol from Elements WHERE Type=Metal AND Atomic Mass > 30 c) SELECT Symbol, Atomic Mass from Elements WHERE Melting Point < -200 d) SELECT Name from Elements WHERE Type=Metal OR Atomic Number < 3 e) SELECT Symbol from Elements WHERE Atomic Mass < 10 OR Atomic Mass > 35

5 This is a database table called Elements
Atomic Number Symbol Name Atomic Mass Melting Point Boiling Point State Type 1 H Hydrogen 1.0 -259.1 -252.9 Gas Non-metal 2 He Helium 4.0 -272.2 -268.9 3 Li Lithium 7.0 180.5 1342 Solid Metal 4 Be Beryllium 9.0 1278 2970 5 B Boron 10.8 2079 2550 Metalloid 6 C Carbon 12.0 3367 4827 7 N Nitrogen 14.0 -209.9 -195.8 8 O Oxygen 16.0 -218.4 -183 9 F Fluorine 19.0 -219.8 -188.1 10 Ne Neon 20.2 -248 -248.7 11 Na Sodium 23.0 97.8 883 12 Mg Magnesium 24.3 649 1090 13 Al Aluminum 27.0 660 2467 14 Si Silicon 28.1 1410 2355 15 P Phosphorus 31.0 44.1 280 16 S Sulphur 32.1 112.8 444.7 17 Cl Chlorine 35.5 -101 -34.6 18 Ar Argon 39.9 -189.2 -185.7 19 K Potassium 39.1 63.25 760 20 Ca Calcium 40.1 839 1484 This is a database table called Elements 4. a) Write a query to list the names of all of the elements that are a gas: b) Write a query to list all of the information about all of the elements that are a Metal:

6 This is a database table called Elements
Atomic Number Symbol Name Atomic Mass Melting Point Boiling Point State Type 1 H Hydrogen 1.0 -259.1 -252.9 Gas Non-metal 2 He Helium 4.0 -272.2 -268.9 3 Li Lithium 7.0 180.5 1342 Solid Metal 4 Be Beryllium 9.0 1278 2970 5 B Boron 10.8 2079 2550 Metalloid 6 C Carbon 12.0 3367 4827 7 N Nitrogen 14.0 -209.9 -195.8 8 O Oxygen 16.0 -218.4 -183 9 F Fluorine 19.0 -219.8 -188.1 10 Ne Neon 20.2 -248 -248.7 11 Na Sodium 23.0 97.8 883 12 Mg Magnesium 24.3 649 1090 13 Al Aluminum 27.0 660 2467 14 Si Silicon 28.1 1410 2355 15 P Phosphorus 31.0 44.1 280 16 S Sulphur 32.1 112.8 444.7 17 Cl Chlorine 35.5 -101 -34.6 18 Ar Argon 39.9 -189.2 -185.7 19 K Potassium 39.1 63.25 760 20 Ca Calcium 40.1 839 1484 This is a database table called Elements 5. a) Write a query to list the names of all of the elements that are either a gas or a metalloid: b) Write a query to list all of the information about all of the elements that have an Atomic Mass of greater than 21:

7 This is a database table called Elements
Atomic Number Symbol Name Atomic Mass Melting Point Boiling Point State Type 1 H Hydrogen 1.0 -259.1 -252.9 Gas Non-metal 2 He Helium 4.0 -272.2 -268.9 3 Li Lithium 7.0 180.5 1342 Solid Metal 4 Be Beryllium 9.0 1278 2970 5 B Boron 10.8 2079 2550 Metalloid 6 C Carbon 12.0 3367 4827 7 N Nitrogen 14.0 -209.9 -195.8 8 O Oxygen 16.0 -218.4 -183 9 F Fluorine 19.0 -219.8 -188.1 10 Ne Neon 20.2 -248 -248.7 11 Na Sodium 23.0 97.8 883 12 Mg Magnesium 24.3 649 1090 13 Al Aluminum 27.0 660 2467 14 Si Silicon 28.1 1410 2355 15 P Phosphorus 31.0 44.1 280 16 S Sulphur 32.1 112.8 444.7 17 Cl Chlorine 35.5 -101 -34.6 18 Ar Argon 39.9 -189.2 -185.7 19 K Potassium 39.1 63.25 760 20 Ca Calcium 40.1 839 1484 This is a database table called Elements 6. a) Write a query to list the names and Atomic Mass of all of the elements that have either a melting point less than 0 or are a gas b) Write a query to list all of the information about all of the elements that are metals with an atomic number less than 10

8 This is a database table called Elements
Atomic Number Symbol Name Atomic Mass Melting Point Boiling Point State Type 1 H Hydrogen 1.0 -259.1 -252.9 Gas Non-metal 2 He Helium 4.0 -272.2 -268.9 3 Li Lithium 7.0 180.5 1342 Solid Metal 4 Be Beryllium 9.0 1278 2970 5 B Boron 10.8 2079 2550 Metalloid 6 C Carbon 12.0 3367 4827 7 N Nitrogen 14.0 -209.9 -195.8 8 O Oxygen 16.0 -218.4 -183 9 F Fluorine 19.0 -219.8 -188.1 10 Ne Neon 20.2 -248 -248.7 11 Na Sodium 23.0 97.8 883 12 Mg Magnesium 24.3 649 1090 13 Al Aluminum 27.0 660 2467 14 Si Silicon 28.1 1410 2355 15 P Phosphorus 31.0 44.1 280 16 S Sulphur 32.1 112.8 444.7 17 Cl Chlorine 35.5 -101 -34.6 18 Ar Argon 39.9 -189.2 -185.7 19 K Potassium 39.1 63.25 760 20 Ca Calcium 40.1 839 1484 This is a database table called Elements 7. a) Find out how to write a query that would list all of the elements whose name started with the letter C b) Find out how to write a query that would list all of the elements whose name ended with the letter m c) Find out how to write a query that would list all of the elements whose name contains the letter n

9 Go to the website: And try using some SQL statements


Download ppt "SQL."

Similar presentations


Ads by Google