I am using SQL and I need a code that will give me this output. You can use the
ID: 3793250 • Letter: I
Question
I am using SQL and I need a code that will give me this output. You can use the names of the columns and rows on these tables to write the code. I just don't know how to write them. Please SQL. Thank you :)
The table definitions are as follows...
Write a query that replicates the result set below, matching all data and format aspects, including column headers: Write a query that replicates the result set below, matching all data and format aspects, including column headers: my_guitar_shop Tables addresses Columns address_id customer_id line1 line2 city state zip_code phone disabled Indexes Foreign Keys Triggers administrators Columns admin_id email_address password first_name last_name Indexes Foreign Keys Triggers categories Columns category_id category_name Indexes Indexes Foreign Keys Triggers customers Columns customer_id email_address password first_name last_name shipping_address_id billing_addressjd Indexes Foreign Keys Triggers order_items Columns item_id order_id product_id item_price discount_amount quantity Indexes Foreign Keys Triggers orders Columns order_id customer_id order date orders Columns order_id customer_id order_date ship_amount tax_amount ship_date ship_address_id card_type card_number card_expires billing_address_id Indexes Foreign Keys Triggers products Columns product_id category_id product_code product_name description list_price discount_percent date_added Indexes Foreign Keys Triggers Views Stored ProceduresExplanation / Answer
If need show all records in a table use,
SELECT * FROM tableName; // This is the basic syntax to list all records in a table. ' * ' indicates the column of the table.
Q.1)
Here am not sure about the table name, since i couldn't find table name from your screenshot.
so considering table name as "product", you can replace this table name as per your table.
Ans: SELECT product_code, product_name, price, discount_percent, price_after_discount FROM product;
In order to get particluar field/column you need to mention like 'product_code, product_name, price, discount_percent, price_after_discount', otherwise you can use '*' to select all field/column from table.
Q.2)
For this, consider table name as "customer", you can replace it as per your table name.
Ans: SELECT Customer_Name, Email_Address FROM customer;
NOTE: If you want to sort by field/column wise then you can use "ORDER BY field/column name". For filter with some conditions use "WHERE" clause eg. SELECT * FROM product WHERE price IS NOT NULL. List record if the price is not null.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.