# UQ-14 Analysis generated on: 4/2/2025 10:13:17 AM --- ## SQL Statement ```sql PARAMETERS MATER Text ( 255 ); SELECT DISTINCTROW UniversalQ.* FROM UniversalQ WHERE ((UniversalQ.MetalType=[MATER])); ``` ## Dependencies - [[Queries/UniversalQ]] ## Parameters - MATER (Empty) ## What it does **SQL Query Description** ========================== ### Overview This SQL query retrieves distinct rows from a table named `UniversalQ` where the value of the `MetalType` column matches the specified parameter `MATER`. ### Parameters * `PARAMETERS MATER`: This is a SQL input parameter with a data type of `Text` and a maximum length of 255 characters. The purpose of this parameter is to specify the metal type that will be used to filter the results. ### Query Logic 1. **SELECT DISTINCTROW**: This keyword selects only distinct rows from the result set, ensuring that each row retrieved contains unique values. 2. `UniversalQ.*`: This specifies that all columns (`*`) from the `UniversalQ` table should be included in the query's result set. The `./* ` syntax after a column name tells SQL Server to return all columns. If you only want specific columns, replace `*` with the desired column names. 3. `FROM UniversalQ`: This specifies that the data should be retrieved from the `UniversalQ` table. 4. `WHERE ((UniversalQ.MetalType = [MATER]))`: This filters the results to include only rows where the value of the `MetalType` column matches the value specified in the input parameter `MATER`. The use of parentheses ensures that the comparison is done before matching any values with `MATER`. ### Example Use Case This query can be used in a scenario where you need to retrieve distinct metal types from a database table. For instance, if you're managing inventory or tracking materials, this query would allow you to filter results based on specific material types. ```sql -- Specify the metal type as an input parameter. DECLARE @MetalType nvarchar(255) = 'Copper'; -- Run the query with the specified metal type. SELECT DISTINCTROW UniversalQ.* FROM UniversalQ WHERE ((UniversalQ.MetalType = @MetalType)); ``` In this example, we're using a `DECLARE` statement to define and initialize an input parameter `@MetalType`, which is assigned the value `'Copper'`. We then run the query with this input parameter.