تسک بعد از مصاحبه با hr به شرح زیر است:

1- تفاوت بین شی و موجودیت
An entity is something that exists in itself, actually or potentially, concretely or abstractly, physically or not. It needs not be of material existence. In computer science, an object is a location in memory having a value and possibly referenced by an identifier.
موجودیت چیزی است که به خودی خود، بالفعل یا بالقوه، به طور ملموس یا انتزاعی، به صورت فیزیکی یا غیر فیزیکی وجود دارد. لازم نیست از وجود مادی باشد. در علم کامپیوتر، یک شی مکانی در حافظه است که دارای یک مقدار است و احتمالاً توسط یک شناسه به آن ارجاع می شود.
2- what are the entity and object in software engineering
موجودیت ها اشیایی هستند که داده های سیستم را نشان می دهند: مشتری، تراکنش، سبد خرید و غیره. مرزها اشیایی هستند که با بازیگران سیستم ارتباط برقرار می کنند: رابط های کاربر، دروازه ها، پراکسی ها، و غیره. کنترل کننده ها اشیایی هستند که میان مرزها و موجودیت ها واسطه می شوند. آنها اجرای دستوراتی را که از مرز می آید هماهنگ می کنند.
Entities are objects representing system data: Customer, Transaction, Cart, etc. Boundaries are objects that interface with system actors: user interfaces, gateways, proxies, etc. Controllers are objects that mediate between boundaries and entities. They orchestrate the execution of commands coming from the boundary.
3- درک بیشتر: لینک
A database is a organized collection of logical related data stored in a software named Database Management Systems (DBMS).
دیتابیس مجموعه ای از روابط منطقی بین داده هاست که در یک نرم افزار به نام DBMS قرار گرفته اند.
Before inserting the data into the system, it needs to be in the form of a model for appropriate understanding of the database.
قبل از لود دیتا در دیتابیس باید به فرم مدل مناسب تغییر کند
Many models were introduced and Entity-Relationship model is one among them.
مدلهای متنوعی معرفی شده اند که entity relation ship model یکی از آنهاست.
It is a graphical representation of the data which gives the whole view of the data.
نمایش گرافیکی داده ها که ویوی کل داده ها را شامل میشود.
There are basic building units of this E-R model where entity and object are among them.
حال المان های اساسی در این مدل E-R وجود دارند که object و entity دو نمونه از آن هستند.
تعریف دارایی و ویژگی آن:
– متفاوت بودن از سایرین
– با توجه به ویژگی هایش تعریف میشود.
– دارایی میتواند در قالب pictorial نمایش داده شود.
– مجموعه ای از دارایی ها entity set هستند.
1. Entity: An entity is a real time object that is different from others. An entity can defined using its attributes. They are a part of entity. Entities can be represented in pictorial form. Collection of similar entities is an entity set.
مثال:

2. Object: An entity that contains both attributes and actions is its object. It is defined by its life span, name and object identifier. Every object has two components: State and Behavior.
دارایی که شامل ویژگی و اکشن باشد را شی گویند. بر اساس 3 پارامتر (طول عمر، نام و object identifier ) تعریف میشود. هر شی دو جز دارد (state and behavior)

مقایسه:
1- دارایی همینجوری از بقیه قابل تمییز است—– شی نه.
2-دارایی شامل ویژگی است—– شی دارای (طول عمر، نام و object identifier) است.
3- دارایی به صورت یونیک قابل تمییز است.—– شی بر اساس identifier آن مشخص میشود
4- هر دارایی یک primary key دارد —–Object is a part of object oriented database.
5- دارایی بخشی از دیتابیسrealtional است —- شی بخشی از دیتابیس object oriented است.
6-

6- دارایی و نمایش در مستطیل و دیاگرام E-R —-اشیا به صورت گرافیکی نمایش داده نمیشوند
7-Attributes is a property of entity. —- ارث بری، انتزاع و… از ویژگی های شی هستند
8-مثال از دارایی: کامپیوتر————- مثال از شی : حداقل سن رای دادن 18 سال است.

ادامه از این رفرنس:
Databases are vital tools for storing, managing, and retrieving information.
They are also critical for building an e-commerce system.
دیتابیس در ایجاد یک سامانه ecommerce اهمیت زیادی دارد.
A well-structured database powers e-commerce and manages all the interactions within the system.
یک دیتا بیس خوب ، یک سامانه فروش الکترونیکی را قدرت میدهد و تمام تعاملات آن را مدیریت میکند.
سه ویژگی دیتا بیس خوب
یک دیتا بیس خوب شامل موارد زیر است:
- 1- سادگی ساختار دیتابیس:
ساده است اما تمام نیازهای مشتری را برطرف میسازد. - 2- پرفرومنس بالا:
کوئری های دیتابیس سرعت بالایی دارند. و باید پرفورمنس دیتابیس طوری باشد که کاربر تجربه خوبی از خرید داشته باشد. بنابراین دیتابیس باید indexing خوبی داشته باشد و همچنین good performance optimization options.

- 3- قابل اسکیل شدن و availability
قابلیت مدیریت کردن ترافیک بالا و همچنین قابلیت بزرگ شدن اشل کاری را داشته باشد.
براساس آنچه گفته شد، سه عامل کلیدی باید در یک سامانه e-commerce موجود باشد:

1- ساختار جداول دیتابیس – روابط بین آن – index های مناسب
2- نوع دیتابیس – این مورد باید بر اساس الزامات مورد نیاز و ساختار داده موجود تعیین شود.

3- زیرساخت دیتا بیس- مدیریت شده یا غیر آن –

In this article, we will review examples of e-commerce databases as they
relate to these three areas.
در این مقاله در مورد دیتابیس های ecommerce صحبت میکنیم که 3 مورد فوق را مربوط میشوند.
We will also explore database design
alternatives that simplifying data management for e-commerce, specifically
a product information manager
همچنین در مور روشهای alternative صحبت میکنیم که مدیریت دیتا در e-commerce را آسان کنند – بویژه مدیریت اطلاعات محصولات
Database Scope
The main consideration when designing the database is identifying the
functionalities offered by the e-commerce platform.
مهمترین عامل در طراحی دیتابیس، تشخیص قابلیت های مورد نیاز مشتری یا سیستم e-commerce است. یعنی اینکه چه میخواهیم.
These functionalities
can be further divided into core functions and additional functions.
قابلیت ها شامل اصلی ها و اضافی ها هستند. ساندویچ اصلیه، حالا سس اضافه هم ممکنه داشته باشیم. 🙂
Core functions
are the functions necessary for facilitating the day-to-day
operations of the e-commerce platform, including
- user management,
- product and inventory management,
- shopping cart function,
- payment management,
- and shipping/logistics management.
قابلیت اصلی آن است که هر روز با آن سر و کار داریم. که شامل موارد زیر میشود:
- مدیریت مشتریان
- مدیریت فهرست محصولات
- قابلیت کارت خرید shopping cart
- مدیریت درگاه پرداخت
- مدیریت ارسال کالا یا لاجستیک
Additional functions
are the nice-to-have functions for the e-commerce
platform that enhance the user experience for both end-users (customers)
and administrators (the business).
قابلیت های nice-to-have functions در یک پلتفرم e-Commerce باعث بهبود تجربه کاربری میشوند. چه تجربه مشتری (خریدار) و چه تجربه ادمین (فروشنده)
Additional functions include marketing
functions, help desk and support, advanced analytics, and third-party
integrations
قابلیت های غیر ضروری شامل موارد زیر است:
- قابلیت های مارکتینگ– مثل تبلیغات بنری و …
- پشتیبانی آنلاین
- آنالیز پیشرفته
- قابلیت حضور شخص سوم – تعامل با دیگری- مثلا فروش کالای دیجی کالا در سایت خودمان
Core functions
In this section, let’s see how to structure the database to facilitate the core
functions.
حالا بریم ببینیم چطور قابلیت اصلی رو پیاده سازی کنیم.
The following table structure is an example of a database design
that covers the core functionality of an e-commerce platform
ساختار جداول زیر مثالهایی از طراحی دیتابیس هستند که قابلیت اصلی پلتفرم e-commerce را پوشش میدهند.

تفسیر جدول 1
بخشی از آنچه در تصویر بالا مشاهده میشود:
- یک جدول به نام product_category داریم. که یک id دارد که همین عامل ارتباط آن با جدول محصول شده است.
- یک جدول به نام product داریم که عامل مشترک آن با product_id یک شی به نام category_id است. یعنی برای اینکه بدانیم یک product در چه category قرار دارد به سادگی از عامل مشترک آن باجدولcategory_id استفاده کرده ایم.
- جدول لیست محصولات داریم به نام product_inventory که id آن در جدول product نیز وجود دارد. زیرا باید بدانیم هر محصول در فهرست محصولات در چه جایگاهیی قرار دارد.
- جدول تخفیف یا discount – یک جدول داریم که تخفیفات در آن است . مثلا فرض کنیم تخفیف yalda که نام آن است و یک id که شماره آن است. حال این id در جدول محصول نیز وجود دارد. بنابراین محصول اگر تخفیف داشته باشد و با id شماره یک مشخص شده باشد، متوجه میشویم که آن محصول تخفیفyalda در موردش صدق میکند.
- تمام 🙂

This example covers all the basics of an e-commerce platform.
این مثالها تمامی اصول پلتفرم های ecommerce را پوشش میدهند.
Here, the table fields and indexes depending on the design of the overall platform.
در اینجا ردیف و ستون جداول به طراحی جداول بستگی دارند.
It contains three separate sections for user management, product
management, and shopping process.
که شامل سکشن مجزا میشوند، 1- مدیریت یوزر – 2 مدیریت محصول – 3- فرآیند خرید
Let’s have a closer look at each
بریم دقیق تر بررسیشون کنیم.
مدیریت یوزر

We have created a user table that contains all the user details along
with user_payment
and user_address
tables to store multiple addresses and payment details of users.
در جدول user کاربر یک id دارد که این id در دو جدول دیگر نیز به کار رفته است1- پرداخت کاربر 2- آدرس کاربر
This structure offers more granular control over data while eliminating duplicate records.
این ساختار ضمن حذف رکوردهای تکراری، کنترل گرانول (موردی، دانه ای، تکی -) بیشتری بر روی داده ها ارائه می دهد.
Another way to manage users is by creating two separate user tables for end-users and administrators and assigning relationships according to their requirements, as shown below.
راه دیگر برای مدیریت کاربران، ایجاد دو جدول کاربری مجزا برای کاربران نهایی و مدیران و تخصیص روابط بر اساس نیاز آنها است، همانطور که در زیر نشان داده شده است.

Product management
Managing products is not simply about maintaining a list of products.
مدیریت محصول ، به تنهایی فقط شامل مدیریت لیست محصولات نمیشود.
You also have to manage the inventory, discounts, categories, and other attributes of the products.
زیرا باید سایر ویژگی های آنان نیز مدیریت شود. مثل (لیست محصول – تخفیفات – دسته مرتبط با آنها – )
So always focus on simplifying the data structure while reducing duplicates. In the following table structure, the main product table contains information about the products.
بنابراین همیشه سعی داریم ساختار داده را ساده کنیم، ضمن اینکه موارد duplicate را کم میکنیم. در ساختار جدول زیر جدول اصلی محصول، شامل اطلاعاتی در مورد محصول است:

There are two other separate tables called discount
, product_inventory
, and product_category
that are connected to it through database relationships. This approach provides the greatest level of flexibility to the database.
سه جدول دیگر به نام تخفیف discount و لیست محصول product inventory و دسته محصول product category وجود دارد که به جدول اصلی محصول از طریق روابط در DB متصل هستند. این روش باعث ایجاد نوعی flexibility در DB میشود.
For instance, we can simply query the product_inventory
table to check for inventory without going through all the data associated with other related tables.
برای مثال میتوانیم به سادگی در جدول فهرست محصول کوئری بزنیم که فهرست را چک کرده باشیم. بدون اینکه نیاز باشد به سراغ تمام دیتا ها در جداول دیگر برویم (صرفه جویی زمانی و محاسباتی)
This is also a good place to utilize indexes to increase the performance of the database.
برای افزایش flexibility از index در جداول استفاده میشود.
Shopping process
This is the most critical and complex part when it comes to designing the database.
این بخش مهمترین بخش از طراحی DB است.
The shopping process will guide a user to search the products, add the desired products to the shopping cart, and finally complete the transaction using a payment provider.
پروسه خرید به کاربر کمک میکند که محصولات را سرچ کند و محصول دلخواه را به shopping card بیافزاید و در نهایت تراکنش را با سرویس دهنده payment service به انجام برساند.

The heart of the e-commerce process connects users with products.
A good chunk of design effort should be exhausted to streamline the shopping process.
قلب فرآیند تجارت الکترونیک، کاربران را با محصولات مرتبط می کند. بخش خوبی از تلاش طراحی باید برای ساده کردن فرآیند خرید تمام شود.
In the example above, there are shopping_session
and cart_item
as temporary data stores that only store the shopping session information of the current user until the order is confirmed and the data is moved to permanent storage tables with the payment details (order_details
, order_items
, and payment_details
).
در مثال بالا، shopping_session و cart_item به عنوان انبار داده موقت وجود دارند که فقط اطلاعات shopping_session
کاربر فعلی را تا زمانی که سفارش تأیید شود ، نگه میدارند. در صورت تایید نهایی دادهها در جداول ذخیره دائمی با جزئیات پرداخت (order_details، order_items و payment_details) ذخیره میشوند.
As shown in this section, the scope of the database structure is determined by the overall functionality of the platform.
همانطور که در این بخش نشان داده شده است، محدوده ساختار پایگاه داده با عملکرد کلی پلت فرم تعیین می شود.
Therefore, it is paramount that you properly define the required functionality before diving into designing the database.
بنابراین، بسیار مهم است که قبل از شروع به طراحی پایگاه داده، عملکرد مورد نیاز را به درستی تعریف کنید.
This way, you can create a clearly defined data structure with enough flexibility to support future expansions.
به این ترتیب، می توانید یک ساختار داده به وضوح تعریف شده با انعطاف کافی برای پشتیبانی از توسعه های آینده ایجاد کنید.
Database Type
The next consideration is to determine the type of database.
قدم بعدی تعیین نوع DB است.
To have the best e-commerce DB design, you must first consider two main database types:
دو نوع DB اصلی داریم:
RDBMS or NoSQL databases.
Relational e-commerce database example
مثال از نوع رابطه ای:
از جدول استفاده میشود و شبیه به spreadsheets است. که ردیف و ستون دارد که برای بازیابی دیتا از آن استفاده میشود.
This is similar to spreadsheets and uses tables, columns, and rows to organize and retrieve data.
از زبان SQL استفاده میشود و تمام داده ها به هم مرتبط هستند.
It is built using the standard query language (SQL) and all the data is related to each other.
مثال هایی از DB رابطه ای در زیر آورده شده است:
- MySQL
- PostgreSQL
- MariaDB
- Microsoft SQL
- Amazon RDS
- Azure SQL
Examples include , , MariaDB, Microsoft SQL, Amazon RDS, and Azure SQL Database.
Many e-commerce sellers use a relational database design centered around the following tables:
بسیاری از افراد فعال در حوزه تجارت الکترونیک از جداول زیر استفاده میکنند:
- customers table
- orders table
products table, customers table, and orders table. Additional tables can be added as required to support shipping, categories, product reviews, and more.
جداول اضافی میتوانند اضافه شوند که خرید را تسهیل کنند، مانند:
- categories
- product reviews
We have covered the database structure in the previous section where the scope of the database was defined.
در مورد ساختار DB صحبت کردیم
Below, you can see a diagram of a simple e-commerce database design built using MySQL.
در زیر یک ساختار ساده از E-commerce تولید شده توسط mysql دیده میشود:

ادامه از این لینک قابل مطالعه است.
تمرین عملی:
با دستور زیر یک دیتا بیس تست میسازیم:
CREATE DATABASE testDB
و با کد زیر ازDB های موجود استعلام میگیریم:
SHOW DATABASES