Use SALECO or LARGECO to answer to perform the following queries: 1. Query the d
ID: 3840613 • Letter: U
Question
Use SALECO or LARGECO to answer to perform the following queries: 1. Query the data dictionary to return the top 3 largest tables in LARGECO. Show the table names and sizes in MB. 2. Create a new user for LARGECO. 3. Grant this new user SELECT and UPDATE privileges across all tables. Run SHOW GRANTS for your new user. 4. Use AES encryption to encrypt the top 5 passwords of 2016 (create your own key): a. 123456 - Key: ____________, Value:___________________ b. 123456789 - Key: ____________, Value:___________________ c. qwerty- Key: ____________, Value:___________________ d. 111111- Key: ____________, Value:___________________ e. 1234567890- Key: ____________, Value:___________________ 5. What is the estimated MySQL execution cost for joining LGINVOICE and LGCUSTOMER and returning CUST_LNAME, INV_NUM and INV_TOTAL within LARGECO for a non-cached query?
Explanation / Answer
SELECT t.NAME AS TableName, i.name as indexName, sum(p.rows) as RowCounts, sum(a.total_pages) as TotalPages, sum(a.used_pages) as UsedPages, sum(a.data_pages) as DataPages, (sum(a.total_pages) * 8) / 1024 as TotalSpaceMB, (sum(a.used_pages) * 8) / 1024 as UsedSpaceMB, (sum(a.data_pages) * 8) / 1024 as DataSpaceMB FROM sys.tables t INNER JOIN sys.indexes i ON t.OBJECT_ID = i.object_id INNER JOIN sys.partitions p ON i.object_id = p.OBJECT_ID AND i.index_id = p.index_id INNER JOIN sys.allocation_units a ON p.partition_id = a.container_id WHERE t.NAME NOT LIKE 'dt%' AND i.OBJECT_ID > 255 AND i.index_idRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.