본문 바로가기

Issue Note12

Difference between 'num for num in range' and 'for num in range' (Python) While studying Python, I wondered about 'num for num in range' and 'for num in range'. They seemed similar yet had different use cases, and I needed to understand when to use each in different situations. Here are explanations: 1. `num for num in range` (List Comprehension): # List Comprehension Example: Creating a list with numbers from 0 to 4 my_list = [num for num in range(5)] print(my_list) .. 2024. 4. 2.
Difference between list and [] (Python) The difference between `list()` and `[]` lies in their usage and purpose in Python. list(): - `list()` is a built-in Python function used to convert an iterable object into a list. It takes an iterable object (such as a tuple, string, or range) as an argument and returns a new list containing the elements of that iterable. - Example: `list((1, 2, 3))` will return `[1, 2, 3]`. [ ] (square bracket.. 2024. 4. 2.
DATE - [SQL} While using SQL, I've always found myself confused about date formats when solving problems related to dates. In the content below, I need to filter data for January, but the function I wasn't the best way. SELECT category, sum(sales) 'Total_sales' from book b inner join book_sales s on b.book_id = s.book_id WHERE sales_Date BETWEEN '2022-01-01' AND '2022-01-31' group by 1 order by category When.. 2024. 4. 1.
Exclusion of NULL values in b.customer_id column in SQL query [SQL] I had a question about the above SQL code. Looking at the code, the query 'where b.customer_id is not null' is searching for non-null values in the customer_id column. However, there are no null values in the b.customer_id column, and null values in b.name and b.age are excluded. I was curious about the reason for this. select a.order_id, a.customer_id, a.restaurant_name, a.price, b.name, b.age,.. 2024. 3. 22.
Table name from Subquery [SQL] I was looking for the column "age" from table B, but when I used "b.age", it resulted in an error. Error code SELECT a.cuisine_type, a.price, 할인률, b,age, a.price-(price*할인률) 'after_discount' FROM ( SELECT a.cuisine_type, a.price, b.age, if(b.age>50,(b.age-50)*0.005,0) '할인률' from food_orders a left join customers b on a.customer_id=b.customer_id ) a order by 할인률 desc The error occurred because th.. 2024. 3. 21.
Red highlighted error [SQL] I received an error message, but the result is fine. I can't find any issues, but the SQL system highlighted the word. SELECT a.cuisine_type, a.price, discount, age, a.price-(price*discount) 'after_discount' FROM ( SELECT a.cuisine_type, a.price, b.age, if(b.age>50,(b.age-50)*0.005,0) 'discount' from food_orders a left join customers b on a.customer_id=b.customer_id ) a order by discount desc 2024. 3. 21.