Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Done #10

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Done #10

Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions queries.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,57 +8,76 @@

<!-- Your Query Goes Here -->

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');

<br>

**2. Get all the fields of the library that was released earliest (first).**
SELECT \* FROM jslibraries
ORDER BY release_date ASC
LIMIT 1;

<!-- Your Query Goes Here -->

<br>

**3. Get all the fields of the library that was released most recently (last).**
SELECT \* FROM jslibraries
ORDER BY release_date DESC
LIMIT 1;

<!-- Your Query Goes Here -->

<br>

**4. All the libraries released before 2015.**
SELECT \* FROM jslibraries WHERE release_date >= '01-01-2015'
ORDER BY release_date ASC

<!-- Your Query Goes Here -->

<br>

**5. Get the `name` and the `release_date` of the libraries without a licence.**
SELECT name,release_date FROM jslibraries WHERE NOT licence = 'MIT LICENSE'

<!-- Your Query Goes Here -->

<br>

**6. Get the `name` and the `stars` from all CSS Framework libraries.**
SELECT name,stars FROM jslibraries WHERE type = 'CSS Framework'

<!-- Your Query Goes Here -->

<br>

**7. Get the `name` of the libraries where the main technology is Typescript.**
SELECT name FROM jslibraries WHERE main_technology = 'typescript'

<!-- Your Query Goes Here -->

<br>

**8. Get the `name` and the `type` of all the libraries with more than 1000 contributors.**
SELECT name,type FROM jslibraries WHERE contributors > 1000

<!-- Your Query Goes Here -->

<br>

**9. Get the total number of `stars` of all the libraries.**
SELECT SUM(stars) FROM jslibraries

<!-- Your Query Goes Here -->

<br>

**10. Get the average number of `contributors` for all the libraries.**
SELECT AVG(contributors) FROM jslibraries

<!-- Your Query Goes Here -->

Expand All @@ -71,30 +90,41 @@
<br>

**12. Update the `used_by` field of the libraries that don't have this information to store `'unknown'` instead of `NULL`.**
UPDATE jslibraries
SET used_by = 'unknown'
WHERE used_by IS NULL;

<!-- Your Query Goes Here -->

<br>

**13. Update all the records to capitalize the string provided in the `main_technology` field.**
UPDATE jslibraries
SET main_technology = CONCAT(
UPPER(SUBSTRING(main_technology, 1, 1)),
LOWER(SUBSTRING(main_technology, 2, LENGTH(main_technology)))
);

<!-- Your Query Goes Here -->

<br>

**14. Delete all the records where `licence` is `'unknown'`.**
DELETE FROM jslibraries WHERE licence = 'unknown'

<!-- Your Query Goes Here -->

<br>

**15. Delete all the records with 10000 or less `stars`.**
DELETE FROM jslibraries WHERE stars <= 10000

<!-- Your Query Goes Here -->

<br>

**16. Delete all the records with less than 100 `releases`.**
DELETE FROM jslibraries WHERE releases <= 100

<!-- Your Query Goes Here -->

Expand Down