The embodiment of the invention discloses a database-based ship workpiece statistical method and device, equipment and a medium. The method comprises the following steps of obtaining an intermediate database containing a plurality of workpiece objects to be processed from a set design and manufacturing total database according to an engineering number; obtaining a preset segment number based on the project number, and grouping the to-be-processed workpiece models in the intermediate database through the preset segment number to obtain at least one group of object sets; aiming at each group of object sets, analyzing the workpiece objects one by one, and obtaining a workpiece name and attribute information corresponding to each workpiece object; and obtaining workpiece names and attribute information of all workpiece objects in the intermediate database, and displaying a statistical result according to a preset segment number, the workpiece names and the attribute information. According to the method, the data is directly extracted from the database, manual one-by-one statistics is not needed, the statistical duration of the workpieces is shortened, the accuracy rate is improved, grouping processing is carried out according to the preset segment number, and the data processing and statistical result arrangement rate is improved.