I am unable to select more than 1 row from a sql table.
I can only do
Select top 1 * from [table_name]
or
Select [pk_table] from [table_name].
Any other command just keeps processing and the table only has about 300 records with 10 columns.
Table Schema:
CREATE TABLE [dbo].[tb1](
[myid] [int] IDENTITY(1,1) NOT NULL,
[cl1] [int] NULL,
[cl2] [int] NULL,
[cl3] [varchar](5) NOT NULL,
[cl4] [varchar](5) NULL,
[cl5] [tinyint] NULL,
CONSTRAINT [PK_tb1_Tbl] PRIMARY KEY CLUSTERED
(
[myid] ASC
)
WITH (PAD_INDEX = OFF,
STATISTICS_NORECOMPUTE = OFF,
IGNORE_DUP_KEY = OFF,
ALLOW_ROW_LOCKS = ON,
ALLOW_PAGE_LOCKS = ON)
ON [PRIMARY]
) ON [PRIMARY]
I am not sure what is causing the problem here since same table schema is working in other database.
You can use following query to find out running queries in your DB:
select
p.spid
, right(convert(varchar,
dateadd(ms, datediff(ms, P.last_batch, getdate()), '1900-01-01'),
121), 12) as 'batch_duration'
, P.program_name
, P.hostname
, P.loginame
from master.dbo.sysprocesses P
where P.spid > 50
and P.status not in ('background', 'sleeping')
and P.cmd not in ('AWAITING COMMAND'
,'MIRROR HANDLER'
,'LAZY WRITER'
,'CHECKPOINT SLEEP'
,'RA MANAGER')
order by batch_duration desc
Related
Hello… I am trying to figure out how to look under ModelName column, which could contain duplicate values and see if ReleaseType column for that same model contains “Final Release.” If yes, do nothing, if not Return Unique ModelName (perhaps based on the latest Date). Fields in Green are the one I am trying to show and the one in red should not be visible:
Is this something that could be done in SQL Server 2019?
Here are my tables:
CREATE TABLE [dbo].[Model](
[ID] [int] IDENTITY(1,1) NOT NULL,
[ModelName] [nvarchar](50) NOT NULL,
[FormFactorID] [int] NOT NULL,
[Revision] [nvarchar](4) NOT NULL,
[SVID] [nvarchar](4) NOT NULL,
[SSID] [nvarchar](4) NULL,
[Picture] [varbinary](max) NULL,
[NVME] [nvarchar](4) NULL,
[ReleaseStatusID] [int] NULL,
CONSTRAINT [PK__Model__3214EC27B0574C2B] PRIMARY KEY CLUSTERED
CREATE TABLE [dbo].[ReleaseType](
[ID] [int] IDENTITY(1,1) NOT NULL,
[ReleaseType] [nvarchar](15) NULL,
CONSTRAINT [PK__ReleaseT__3214EC27CD0730DB] PRIMARY KEY CLUSTERED
CREATE TABLE [dbo].[ProductRelease](
[ID] [int] IDENTITY(1,1) NOT NULL,
[ReleaseTypeID] [int] NULL,
[ModelID] [int] NULL,
[Date] [date] NULL,
[ECO] [nvarchar](10) NULL,
[Notes] [nvarchar](800) NULL,
CONSTRAINT [PK__ProductR__3214EC27CE911F54] PRIMARY KEY CLUSTERED
ID from ReleaseType table joined with ReleaseTypeID from ProductRelease table
ID from Model table joined with ModelID from ProductRelease table
Here is my Query so far:
SELECT
dbo.Model.ModelName,
dbo.ReleaseType.ReleaseType,
dbo.ProductRelease.ECO,
dbo.ProductRelease.Date
FROM
dbo.Model
INNER JOIN dbo.ProductRelease ON dbo.Model.ID = dbo.ProductRelease.ModelID
INNER JOIN dbo.ReleaseType ON dbo.ProductRelease.ReleaseTypeID = dbo.ReleaseType.ID
ORDER BY
dbo.Model.ModelName,
dbo.ProductRelease.Date
Yes, it doable for instance with windowed fucntions:
WITH cte AS (
SELECT m.ModelName,
rt.ReleaseType,
pr.ECO,
pr.Date,
cnt = COUNT(CASE WHEN rt.ReleaseType='Final Release' THEN 1 END)
OVER(PARTITION BY m.ModelName),
rn = ROW_NUMBER() OVER(PARTITION BY m.ModelName ORDER BY pr.Date DESC)
FROM dbo.Model m
JOIN dbo.ProductRelease pr
ON m.ID = pr.ModelID
JOIN dbo.ReleaseType rt
ON pr.ReleaseTypeID = rt.ID
)
SELECT ModelName, ReleaseType, ECO, Date
FROM cte
WHERE cnt = 0 -- exclude groups with 'Final Release'
AND rn = 1 -- get only newest occurence per ModelName
ORDER BY ModelName;
I'm new to SQL Server triggers.
I have 2 tables (one master and one slave) with a primary on multiple columns.
I need to create a trigger on first table in order to synchronize the second table. In which way could I manage an update on multiple rows on a column on primary key?
My tables are:
CREATE TABLE [dbo].[Seasons]
(
[Entity] [nvarchar](4) NOT NULL,
[Code] [nvarchar](5) NOT NULL,
[Description] [nvarchar](50) NULL,
CONSTRAINT [PK_Seasons]
PRIMARY KEY CLUSTERED ([Entity] ASC, [Code] ASC)
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF,
IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON,
ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 10) ON [PRIMARY]
) ON [PRIMARY]
CREATE TABLE [dbo].[Seasons2]
(
[Entity] [nvarchar](4) NOT NULL,
[Code] [nvarchar](5) NOT NULL,
[Description] [nvarchar](50) NULL,
CONSTRAINT [PK_Seasons2]
PRIMARY KEY CLUSTERED ([Entity] ASC, [Code] ASC)
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF,
IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON,
ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 10) ON [PRIMARY]
) ON [PRIMARY]
INSERT INTO [Seasons] VALUES ('XX','11','Test')
INSERT INTO [Seasons] VALUES ('XX','22','Test')
INSERT INTO [Seasons] VALUES ('XX','33','Test')
UPDATE [Seasons]
SET Entity = 'YY'
In the worst case, could I iterate over inserted and deleted tables? These tables are in the same order?
Thank you very much!
I have simple code in Microsoft SQL Server Managment Studio query window.
insert into [clients] ("Addres","companyID") values (NULL,NULL);
SCOPE_IDENTITY();
select * from clients;
When I run it I have error
Msg 102, Level 15, State 1, Line 3
Incorrect syntax near 'SCOPE_IDENTITY'.
What is wrong? Without line SCOPE_IDENTITY(); everything goes fine.
Table clients:
CREATE TABLE [dbo].[clients](
[Id] [int] IDENTITY(1,1) NOT NULL,
[Addres] [nvarchar](200) NULL,
[companyID] [int] NULL,
PRIMARY KEY CLUSTERED
(
[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
Use with select.
insert into [clients] ("Addres","companyID") values (NULL,NULL);
select SCOPE_IDENTITY();
I am trying to build a database (access)for students marks. Every student has many courses and different marks for each course.
Example
John:
Math Q1 = 80, Q2= 90, Q3=77
Art
Q1=75, Q2=85, Q3=80
and so on
I build 3 tables with relations as the following
students(id-name-grade)
courses(courseid-coursename)
marks(id-courseid-Q1-Q2-Q3)
Is my work correct? because I will upgrade it to SQL, so I need to know if the tables and relations are identical for reports and forms?
Ok, but you should rename some fields: courses(id, name), marks(stu_id, course_id, Q1, Q2, Q3)
SQL (I use PostgreSQL, but I think other DBMS similar)
CREATE TABLE students
(
id integer NOT NULL,
fname varchar(20),
lname varchar(20),
grade integer,
PRIMARY KEY (id)
);
CREATE TABLE courses
(
id integer NOT NULL,
name varchar(20),
PRIMARY KEY (id)
);
CREATE TABLE marks
(
stu_id integer REFERENCES students(id),
course_id integer REFERENCES courses(id),
Q1 double,
Q2 double,
Q3 double,
PRIMARY KEY (stu_id, course_id)
);
or
CREATE TABLE marks
(
id integer NOT NULL,
stu_id integer REFERENCES students(id),
course_id integer REFERENCES courses(id),
Q1 double,
Q2 double,
Q3 double,
PRIMARY KEY (id)
);
Hope your help
You should use composite key in marks table. That will not limited you to only 3 questions.
Ms Sql Query for your table creation will look like-
/****** Object: Table [dbo].[students] Script Date: 11/11/2014 16:20:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[students](
[id] [int] NOT NULL,
[fname] [varchar](20) NULL,
[lname] [varchar](20) NULL,
[grade] [int] NULL,
PRIMARY KEY CLUSTERED
(
[id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object: Table [dbo].[courses] Script Date: 11/11/2014 16:19:59 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[courses](
[id] [int] NOT NULL,
[name] [varchar](20) NULL,
PRIMARY KEY CLUSTERED
(
[id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object: Table [dbo].[marks] Script Date: 11/11/2014 16:19:37 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[marks](
[stu_id] [int] NOT NULL,
[course_id] [int] NOT NULL,
[q_id] [int] NOT NULL,
[mark] [numeric](18, 0) NOT NULL,
CONSTRAINT [PK_marks] PRIMARY KEY CLUSTERED
(
[stu_id] ASC,
[course_id] ASC,
[q_id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[marks] WITH CHECK ADD CONSTRAINT [FK_marks_courses] FOREIGN KEY([course_id])
REFERENCES [dbo].[courses] ([id])
GO
ALTER TABLE [dbo].[marks] CHECK CONSTRAINT [FK_marks_courses]
GO
ALTER TABLE [dbo].[marks] WITH CHECK ADD CONSTRAINT [FK_marks_students] FOREIGN KEY([stu_id])
REFERENCES [dbo].[students] ([id])
GO
ALTER TABLE [dbo].[marks] CHECK CONSTRAINT [FK_marks_students]
GO
Want to know which appropriate fields to use in review table.
requirement for review table:
> review will be given by customer
* review in points
* review in description
* review in videos (instead of text can upload review video in which it present review description)
* comments on reviews.
* restriction to display review in public or not
> review for menuItem
> review for restaurants
> review for packs / coupns available
can any one help me who has worked on review system.
review table contains
review_id (pk,autp_increment)
user_id(fk references usier_id in user table)
menu_items_reviews table contains
id (pk,auto_increment),
review_id (fk references review_id in review table),
review_desc (text or varchar(xxx))
this is similar for all other types reviews like restaurants and packs / coupns available
It really depends on your requirements, business rules and application high level design. However you can start with a sample design I am putting up for you.
You must have following tables to enforce these requirements at bare minimum level.
User table ( containing following fields UserId, Name, Phone, EMail)
Menu table ( containing following fields MenuId, Description)
MenuItem table ( containing following fields MenuItemId, MenuId, ItemId,CategoryId)
Item table ( containing following fields ItemId, ItemName, Description, Price, IsActive, IsSpecial)
MenuCategory table ( containing following fields CategoryId, CategoryName, Description, IsActive)
Review comment table ( containing following fields ReviewId, ReviewComment, ReviewRating, UserId, MenuItemId, ReviewDate)
Restaurant table ( containing following fields RestaurantId, Name, AddressLine1, AddressLine2)
RestaurantMenu table (containing following fields RestaurantMenuId, MenuId, RestaurantId)
Coupon table (containing following fields CouponId, Description, StartDate, EndDate, isActive, RestaurantId, [Discount%])
USE [YourDBName]
GO
/****** Object: Table [dbo].[Coupon] Script Date: 1/8/2014 12:44:59 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Coupon](
[CouponId] [int] NOT NULL,
[Description] [nvarchar](200) NULL,
[StartDate] [datetime] NULL,
[EndDate] [datetime] NULL,
[isActive] [bit] NOT NULL,
[RestaurantId] [int] NULL,
[Discount%] [real] NULL,
CONSTRAINT [PK_Coupon] PRIMARY KEY CLUSTERED
(
[CouponId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object: Table [dbo].[Item] Script Date: 1/8/2014 12:44:59 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Item](
[ItemId] [int] NOT NULL,
[ItemName] [nvarchar](50) NOT NULL,
[Description] [nvarchar](255) NULL,
[Price] [money] NOT NULL,
[IsActive] [bit] NOT NULL,
[IsSpecial] [bit] NOT NULL,
CONSTRAINT [PK_Item] PRIMARY KEY CLUSTERED
(
[ItemId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object: Table [dbo].[Menu] Script Date: 1/8/2014 12:44:59 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Menu](
[MenuId] [int] NOT NULL,
[Description] [nvarchar](255) NULL,
CONSTRAINT [PK_Menu] PRIMARY KEY CLUSTERED
(
[MenuId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object: Table [dbo].[MenuCategory] Script Date: 1/8/2014 12:44:59 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[MenuCategory](
[CategoryId] [int] NOT NULL,
[CategoryName] [nvarchar](50) NOT NULL,
[Description] [nvarchar](255) NULL,
[IsActive] [bit] NOT NULL,
CONSTRAINT [PK_MenuCategory] PRIMARY KEY CLUSTERED
(
[CategoryId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object: Table [dbo].[MenuItem] Script Date: 1/8/2014 12:44:59 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[MenuItem](
[MenuItemId] [int] NOT NULL,
[MenuId] [int] NOT NULL,
[itemid] [int] NOT NULL,
[CategoryId] [int] NOT NULL,
CONSTRAINT [PK_MenuItem] PRIMARY KEY CLUSTERED
(
[MenuItemId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object: Table [dbo].[Restaurant] Script Date: 1/8/2014 12:44:59 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Restaurant](
[RestaurantId] [int] NOT NULL,
[Name] [nvarchar](100) NOT NULL,
[Addressline1] [nvarchar](50) NOT NULL,
[Addressline2] [nvarchar](50) NULL,
CONSTRAINT [PK_Restaurant] PRIMARY KEY CLUSTERED
(
[RestaurantId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object: Table [dbo].[RestaurantMenu] Script Date: 1/8/2014 12:44:59 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[RestaurantMenu](
[RestaurantMenuId] [int] NOT NULL,
[Menuid] [int] NOT NULL,
[Restaurantid] [int] NOT NULL,
CONSTRAINT [PK_RestaurantMenu] PRIMARY KEY CLUSTERED
(
[RestaurantMenuId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object: Table [dbo].[Review] Script Date: 1/8/2014 12:44:59 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Review](
[ReviewId] [int] NOT NULL,
[ReviewComment] [nvarchar](500) NULL,
[ReviewRating] [real] NOT NULL,
[UserId] [int] NOT NULL,
[MenuItemId] [int] NOT NULL,
[ReviewDate] [datetime] NOT NULL,
CONSTRAINT [PK_Review] PRIMARY KEY CLUSTERED
(
[ReviewId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object: Table [dbo].[User] Script Date: 1/8/2014 12:44:59 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[User](
[UserId] [int] NOT NULL,
[Name] [nvarchar](50) NOT NULL,
[Phone] [nvarchar](10) NOT NULL,
[Email] [nvarchar](50) NOT NULL,
CONSTRAINT [PK_User] PRIMARY KEY CLUSTERED
(
[UserId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[Coupon] WITH CHECK ADD CONSTRAINT [FK_Coupon_Restaurant] FOREIGN KEY([RestaurantId])
REFERENCES [dbo].[Restaurant] ([RestaurantId])
GO
ALTER TABLE [dbo].[Coupon] CHECK CONSTRAINT [FK_Coupon_Restaurant]
GO
ALTER TABLE [dbo].[MenuItem] WITH CHECK ADD CONSTRAINT [FK_MenuItem_Item] FOREIGN KEY([itemid])
REFERENCES [dbo].[Item] ([ItemId])
GO
ALTER TABLE [dbo].[MenuItem] CHECK CONSTRAINT [FK_MenuItem_Item]
GO
ALTER TABLE [dbo].[MenuItem] WITH CHECK ADD CONSTRAINT [FK_MenuItem_Menu] FOREIGN KEY([MenuId])
REFERENCES [dbo].[Menu] ([MenuId])
GO
ALTER TABLE [dbo].[MenuItem] CHECK CONSTRAINT [FK_MenuItem_Menu]
GO
ALTER TABLE [dbo].[MenuItem] WITH CHECK ADD CONSTRAINT [FK_MenuItem_MenuCategory] FOREIGN KEY([CategoryId])
REFERENCES [dbo].[MenuCategory] ([CategoryId])
GO
ALTER TABLE [dbo].[MenuItem] CHECK CONSTRAINT [FK_MenuItem_MenuCategory]
GO
ALTER TABLE [dbo].[RestaurantMenu] WITH CHECK ADD CONSTRAINT [FK_RestaurantMenu_Menu] FOREIGN KEY([Menuid])
REFERENCES [dbo].[Menu] ([MenuId])
GO
ALTER TABLE [dbo].[RestaurantMenu] CHECK CONSTRAINT [FK_RestaurantMenu_Menu]
GO
ALTER TABLE [dbo].[RestaurantMenu] WITH CHECK ADD CONSTRAINT [FK_RestaurantMenu_Restaurant] FOREIGN KEY([Restaurantid])
REFERENCES [dbo].[Restaurant] ([RestaurantId])
GO
ALTER TABLE [dbo].[RestaurantMenu] CHECK CONSTRAINT [FK_RestaurantMenu_Restaurant]
GO
ALTER TABLE [dbo].[Review] WITH CHECK ADD CONSTRAINT [FK_Review_MenuItem] FOREIGN KEY([MenuItemId])
REFERENCES [dbo].[MenuItem] ([MenuItemId])
GO
ALTER TABLE [dbo].[Review] CHECK CONSTRAINT [FK_Review_MenuItem]
GO
ALTER TABLE [dbo].[Review] WITH CHECK ADD CONSTRAINT [FK_Review_User] FOREIGN KEY([UserId])
REFERENCES [dbo].[User] ([UserId])
GO
ALTER TABLE [dbo].[Review] CHECK CONSTRAINT [FK_Review_User]
GO
Review Table Contains
1. reviewId (INT, Primary key, Auto Increment)
2. restaurantId (INT, ForeignKey of restaurant table)
3. userId (INT, ForeignKey of user_master table)
4. menuItemId (INT, ForeignKey of menuItem table)
5. couponId (INT, ForeignKey of packs / coupons table)
6. title (VARCHAR)
7. comment (VARCHAR or TEXT)
8. reviewePoints (TINYINT)
9. reviewedOn (DATETIME)
10. status (TINYINT)
as per my senior suggestion its need to be like this:
user_reviews
- id
- restaurant_menu_item_id
- restaurant_id
- customer_id
- review_title : title like wow / superb / or ...
- review_points : from 1 - 10
- description : limit it to ...
- review_video_id
- created_bye
- created_date
- update_date
- status
I think this works fine for now as well as future (i mean it allow me to change in future if required)