Skip to content

Latest commit

 

History

History
107 lines (67 loc) · 3.34 KB

queries.md

File metadata and controls

107 lines (67 loc) · 3.34 KB

logo_ironhack_blue 7

Answers

Iteration 2

1. Add the solid and chartjs libraries as new rows to the jslibraries table.

INSERT INTO jslibraries (name, owner, description, stars, url, releases, licence, used_by, contributors, main_technology, type,release_date) VALUES ('solid','solidjs','A declarative, efficient, and flexible JavaScript library for building user interfaces.',10700,'solidjs.com',194,'MIT License',624,73,'typescript','UI Library','2011-08-13'),('chartjs','chartjs','Simple HTML5 Charts using the canvas tag.',54700,'chartjs.org',85,'MIT License',414000,377,'javascript','Charts Library','2011-11-02');


2. Get all the fields of the library that was released earliest (first).

SELECT * from jslibraries ORDER BY release_date asc;


3. Get all the fields of the library that was released most recently (last).

SELECT * from jslibraries ORDER BY release_date desc;


4. All the libraries released before 2015.

SELECT * FROM jslibraries WHERE release_date <= '2015-01-01'; SELECT * from jslibraries ORDER BY release_date asc limit 6 ;

5. Get the name and the release_date of the libraries without a licence.

SELECT name , release_date, licence FROM jslibraries where licence isnull;


6. Get the name and the stars from all CSS Framework libraries.

SELECT name, stars FROM jslibraries WHERE type = 'CSS Framework';


7. Get the name of the libraries where the main technology is Typescript.

SELECT name FROM jslibraries WHERE main_technology = 'typescript';


8. Get the name and the type of all the libraries with more than 1000 contributors.

SELECT name, type FROM jslibraries WHERE contributors > 1000;

9. Get the total number of stars of all the libraries.

SELECT stars FROM jslibraries;

10. Get the average number of contributors for all the libraries.

SELECT AVG(contributors) FROM jslibraries;

11. Update the licence field of the libriaries without a licence to store 'unknown' instead of NULL.

UPDATE jslibraries SET licence = 'unknown' WHERE licence isnull;

12. Update the used_by field of the libraries that don't have it specified to store 0 ( i.e., number zero), instead of NULL.

UPDATE jslibraries SET used_by = 0 where used_by isnull;

13. Update all the records to capitalize the string provided in the main_technology field.

UPDATE jslibraries SET main_technology = UPPER(main_technology);

14. Delete all the records where licence is 'unknown'.

Delete from jslibraries where licence = 'unknown';

15. Delete all the records with 10000 or less stars.

Delete from jslibraries where stars <= 10000;

16. Delete all the records with less than 100 releases.

Delete from jslibraries where releases < 100;