Master DM Database: Download, Install, Core & Advanced SQL – A Complete Guide
This guide walks you through downloading and installing the DM (达梦) database, creating databases, using the client, mastering basic and advanced SQL syntax, comparing it with MySQL, Oracle, and SQL Server, and highlights its performance, security, and compatibility features.
DM Database: Download, Installation, Basic & Advanced Syntax, and Comparison
1. Download DM Database
Official download link: https://www.dameng.com/DM8.html
2. Install DM Database
Extract the ISO image and run setup.exe.
Select language and time zone, then proceed with default options.
Choose installation path (must be empty) and configure optional settings.
3. Create a Database
Run the dbca tool under the tool directory to initialize a database instance.
Specify control, data, log, and initialization file locations.
Configure user name and password.
4. Use the DM Client
Open the manager program under the tool directory. The interface is similar to other client tools.
5. Basic SQL Syntax
1. Database objects
CREATE DATABASE my_database; CREATE TABLE employees (
employee_id INT PRIMARY KEY,
first_name VARCHAR(50),
last_name VARCHAR(50),
hire_date DATE,
salary DECIMAL(10, 2)
); ALTER TABLE employees ADD department VARCHAR(50);
ALTER TABLE employees MODIFY salary DECIMAL(12, 2);
DROP TABLE employees;2. Data manipulation
INSERT INTO employees (employee_id, first_name, last_name, hire_date, salary)
VALUES (1, 'John', 'Doe', '2024-01-15', 50000.00); SELECT * FROM employees;
SELECT * FROM employees WHERE salary > 40000;
SELECT e.first_name, e.last_name, d.department_name
FROM employees e
JOIN departments d ON e.department_id = d.department_id; UPDATE employees SET salary = salary * 1.05 WHERE hire_date < '2023-01-01';
DELETE FROM employees WHERE employee_id = 1;6. Advanced SQL Syntax
1. Views and indexes
CREATE VIEW high_salary_employees AS
SELECT first_name, last_name, salary
FROM employees
WHERE salary > 50000; SELECT * FROM high_salary_employees; CREATE INDEX idx_salary ON employees (salary);2. Stored procedures and triggers
CREATE PROCEDURE increase_salary(IN percentage DECIMAL(5,2))
BEGIN
UPDATE employees SET salary = salary * (1 + percentage/100);
END; CALL increase_salary(10); CREATE TRIGGER salary_update_trigger
AFTER UPDATE ON employees
FOR EACH ROW
BEGIN
IF NEW.salary > OLD.salary THEN
INSERT INTO salary_audit (employee_id, old_salary, new_salary, update_date)
VALUES (NEW.employee_id, OLD.salary, NEW.salary, SYSDATE);
END IF;
END;3. Transactions and locks
START TRANSACTION;
UPDATE employees SET salary = salary + 1000 WHERE employee_id = 1;
COMMIT;
-- or ROLLBACK;
SELECT * FROM employees WHERE employee_id = 1 FOR UPDATE;
LOCK TABLE employees IN EXCLUSIVE MODE;7. Comparison with Other Databases
DM vs MySQL Both support CREATE DATABASE and CREATE TABLE , but data types and defaults differ. DM uses Oracle‑like date functions (e.g., TO_DATE ), while MySQL uses STR_TO_DATE . Both support views and indexes, though some index options differ. DM vs Oracle Object creation and constraints are very similar. Stored procedures and triggers share the same syntax. Transaction control uses START TRANSACTION , COMMIT , similar to Oracle. DM vs SQL Server All support standard CREATE DATABASE and CREATE TABLE . Procedures and triggers differ in T‑SQL syntax. SQL Server uses BEGIN TRANSACTION / COMMIT while DM follows standard SQL.
8. Advantages of DM Database
Performance Optimized query processor and support for B‑Tree and bitmap indexes. Parallel execution on multi‑core CPUs. Effective data caching and memory management. High‑concurrency transaction handling with efficient locking and logging. Security Fine‑grained user and role permissions. Data encryption at rest and in transit (column‑level and transparent). Audit logging of user actions. Built‑in defenses against SQL injection and other attacks. Compatibility Supports standard SQL, easing migration from other systems. Runs on Windows and Linux. Tools for migrating data from Oracle, MySQL, SQL Server, etc. Multiple client interfaces (JDBC, ODBC, etc.).
9. Summary
DM is a domestically developed RDBMS that closely mirrors Oracle in syntax and features, offering strong performance, security, and cross‑platform compatibility, making it a viable alternative for Chinese enterprises.
MaGe Linux Operations
Founded in 2009, MaGe Education is a top Chinese high‑end IT training brand. Its graduates earn 12K+ RMB salaries, and the school has trained tens of thousands of students. It offers high‑pay courses in Linux cloud operations, Python full‑stack, automation, data analysis, AI, and Go high‑concurrency architecture. Thanks to quality courses and a solid reputation, it has talent partnerships with numerous internet firms.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
