Sample Code:
DescribeSObjectResult descResult = Account.getSObjectType().getDescribe(); List<String> fieldList = new List<String>(descResult.Fields.getMap().keySet()); String query = ' SELECT ' + String.join(fieldList, ',') + ' FROM ' + descResult.getName(); List<SObject> records = Database.query(query); System.debug( records );