Skip to content

completed assigment 1 SQL#1

Open
MauxFear wants to merge 1 commit intomainfrom
assignment-one
Open

completed assigment 1 SQL#1
MauxFear wants to merge 1 commit intomainfrom
assignment-one

Conversation

@MauxFear
Copy link
Copy Markdown
Owner

What changes are you trying to make? (e.g. Adding or removing code, refactoring existing code, adding reports)

Complete assignment 1 for the SQL module.

What did you learn from the changes you have made?

How to write queries using SQlite and how to interpret relational databases.

Was there another approach you were thinking about making? If so, what approach(es) were you thinking of?

I would like to learn how to manipulate the tables more similar or comparable with pandas so I can remember more easily the structures.

Were there any challenges? If so, what issue(s) did you face? How did you overcome it?

I have to search the web for the documentation and how to do things such as modify tables.

How were these changes tested?

I run the code using DB Browser for SQLlite

A reference to a related issue in your repository (if applicable)

N/A

Checklist

  • [ X ] I can confirm that my changes are working as intended


SELECT product_id, vendor_id, market_date, customer_id, quantity, cost_to_customer_per_qty, transaction_time -- explicit
, quantity * cost_to_customer_per_qty AS price
FROM customer_purchases;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove ;, the query is not ending here.


-- SELECT * -- NO explicit
SELECT product_id, vendor_id, market_date, customer_id, quantity, cost_to_customer_per_qty, transaction_time /* explicit */
FROM customer_purchases;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove ;



SELECT product_id, vendor_id, market_date, customer_id, quantity, cost_to_customer_per_qty, transaction_time -- explicit
FROM customer_purchases;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove ;


-- SELECT * -- NO explicit
SELECT customer_id, customer_first_name, customer_last_name, customer_postal_code /* explicit */
FROM customer;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove ;

vendor_id field they both have in common, and sorts the result by vendor_name, then market_date. */


SELECT v.*, vc.* -- NO EXPLICIT
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using single * will return all columns in both tables as well.



SELECT v.*, vc.* -- NO EXPLICIT
FROM vendor AS v;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove ;

SELECT cp.customer_id, c.customer_first_name, c.customer_last_name
, sum(cp.quantity*cp.cost_to_customer_per_qty) AS total_purchases

FROM customer_purchases AS cp;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove ;

Copy link
Copy Markdown

@kelichiu kelichiu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Point: 27/30

Section 1: ✅ Complete

Section 2: ☑️ Partial

Where Question 2 and other questions

Todo:

  • ; signifies the end of a query. Please remove extra ; in your queries to prevent errors.

Section 3: ☑️ Partial

Aggregate Question 2

Todo:

  • ; signifies the end of a query. Please remove extra ; in your queries to prevent errors.

Section 4: ✅ Complete

Hi Mauricio, thank you for your thoughtful reflection, I enjoyed reading it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants