Global LockingGlobal locks restrict the entire database instance to a read-only state, preventing any data modification operations (insert, update, or delete) while the lock is active. This is often used for maintenance tasks or consistent backups.-- Acquire a global read lock FLUSH TABLES WITH READ...
Conditional Query Execution Execute queries only when parameter are not empty: SELECT * FROM t_interlinkage WHERE IF('翁二翁' != '', name LIKE '%翁二翁%', 1=1); Enhanced fuzzy search with concatenation: SELECT * FROM t_interlinkage WHERE IF('翁二翁' != '', name LIKE CONCAT('%', '翁二翁', '%'), 1=1); Comma-Separ...
Genarel SQL Syntax Rules SQL statements can span single or multiple lines, terminating with a semicolon Whitespace and indentation improve readability without affecting execution MySQL is case-insensitive for keywords (though uppercase is conventional) Comment syntax: Single-line: -- comment or # co...
In Oracle, the queries SELECT * FROM a, b WHERE a.id = b.id and SELECT * FROM a INNER JOIN b ON a.id = b.id are functionally equivalent. Both produce the same result set by matching rows from tables a and b where the id values are equal. However, they differ in syntax style and clarity. The comma-ba...
Identifying Duplicate Entries in Excel Three methods to locate repeated data in a column: Conditional Formatting: Select the target column. Navigate to Home > Conditional Formatting > Highlight Cells Rules > Duplicate Values. Choose a foramtting style to visually mark duplicates. COUNTIF Fu...
Using explode for Column-to-Row Transformation To convert a delimited string column into multiple rows: SELECT other_cols, exploded_col FROM source_table LATERAL VIEW explode(split(target_column, ',')) tmp AS exploded_col; The split() function breaks the string into an array, explode() turns each ar...
Fundamental Data Selection Retrieving Specific Columns To obtain student names from a pupil table: SELECT pupil_name FROM pupil; Fetching multiple attributes like name and gender: SELECT pupil_name, gender FROM pupil; Selecting all available attributes: SELECT * FROM pupil; The SELECT keyword initia...
1 Encapsulate a Global Object Create a new C++ class named sqlmange, and add sql to the .pro file. Use the C++ singleton pattern to ensure only one instance exists and provide a global access point. The following code implements the SQLManager class, which manages database connections and operations...
Analyzing Object Storage and Segments 1. Assessing Table Size and Row Counts To evaluate storage consumption across all schemas, join the data dictionary views regarding tables and segments. The following query calculates size in gigabytes and retrieves row estimates. -- Segment size analysis across...
Data Definition Language (DDL) DDL encompasses commands used to define and modify database schema structures. These operations affect the organization and properties of database objects rather than the data itself. Key commands include: CREATE: Establishes new database objects ALTER: Modifies existi...